-
-
Save svenstaro/ca7bb1b6a8c339052e27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLOB sdist-make: /home/svenstaro/prj/marshmallow/setup.py | |
py26 create: /home/svenstaro/prj/marshmallow/.tox/py26 | |
ERROR: InterpreterNotFound: python2.6 | |
py27 inst-nodeps: /home/svenstaro/prj/marshmallow/.tox/dist/marshmallow-1.0.1.zip | |
py27 runtests: PYTHONHASHSEED='2556491626' | |
py27 runtests: commands[0] | flake8 . | |
py27 runtests: commands[1] | /home/svenstaro/prj/marshmallow/.tox/py27/bin/python setup.py test | |
running test | |
running egg_info | |
writing top-level names to marshmallow.egg-info/top_level.txt | |
writing marshmallow.egg-info/PKG-INFO | |
writing dependency_links to marshmallow.egg-info/dependency_links.txt | |
reading manifest file 'marshmallow.egg-info/SOURCES.txt' | |
reading manifest template 'MANIFEST.in' | |
writing manifest file 'marshmallow.egg-info/SOURCES.txt' | |
running build_ext | |
============================= test session starts ============================== | |
platform linux2 -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4 -- /home/svenstaro/prj/marshmallow/.tox/py27/bin/python | |
collecting ... collected 387 items | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization_with_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_integer_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_string_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_arbitrary_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_datetime_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc822] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso8601] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_localdatetime_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_time_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_date_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_price_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_relative_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_email_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_with_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_uuid_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_function_must_be_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_method_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method_must_be_a_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_enum_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_datetime_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_none_to_empty_list PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_single_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_validator_must_return_false_to_raise_error PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_validator_with_nonascii_input PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validators PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_custom_error_message PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_values PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_exclude PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_deserialization_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_list_deserialization_to_dict FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_an_email_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_url_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_required_value_only_passed_to_validators_if_provided PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_strict_mode_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_extra_fields PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_strict_raises_error PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_fields_with_attribute_param PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_function PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_many PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_string_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_method_validator PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass0] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass1] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass2] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass3] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass4] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass5] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass6] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass7] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass8] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass9] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass10] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass11] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass12] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass13] PASSED | |
tests/test_deserialization.py::test_required_enum PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_message_in_list PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_pass_list_of_messages PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_dictionaries PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_store_field_name PASSED | |
tests/test_exceptions.py::TestValidationError::test_str PASSED | |
tests/test_fields.py::TestFieldAliases::test_enum_is_select PASSED | |
tests/test_fields.py::TestFieldAliases::test_int_is_integer PASSED | |
tests/test_fields.py::TestFieldAliases::test_str_is_string PASSED | |
tests/test_fields.py::TestFieldAliases::test_bool_is_boolean PASSED | |
tests/test_fields.py::TestField::test_repr PASSED | |
tests/test_fields.py::TestField::test_error_raised_if_uncallable_validator_passed PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass0] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass1] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass2] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass3] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass4] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass5] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass6] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass7] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass8] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass9] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass10] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass11] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass12] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass13] PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_formatted_string_field PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_enum_field PASSED | |
tests/test_legacy.py::test_serializer_alias PASSED | |
tests/test_legacy.py::test_serializing_through_contructor PASSED | |
tests/test_legacy.py::test_errors_property PASSED | |
tests/test_registry.py::test_serializer_has_class_registry PASSED | |
tests/test_registry.py::test_two_way_nesting PASSED | |
tests/test_registry.py::test_nesting_with_class_name_many PASSED | |
tests/test_registry.py::test_invalid_class_name_in_nested_field_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_same_name_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_all PASSED | |
tests/test_registry.py::test_can_use_full_module_path_to_class PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass0] PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass1] PASSED | |
tests/test_schema.py::test_serializer_dump PASSED | |
tests/test_schema.py::test_dump_returns_dict_of_errors PASSED | |
tests/test_schema.py::test_dump_resets_errors PASSED | |
tests/test_schema.py::test_dump_many PASSED | |
tests/test_schema.py::test_dump_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_many PASSED | |
tests/test_schema.py::test_load_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_load_many PASSED | |
tests/test_schema.py::test_loads_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_loads_many PASSED | |
tests/test_schema.py::test_loads_deserializes_from_json PASSED | |
tests/test_schema.py::test_serializing_none PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass0] PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass1] PASSED | |
tests/test_schema.py::test_dumps_returns_json PASSED | |
tests/test_schema.py::test_naive_datetime_field PASSED | |
tests/test_schema.py::test_datetime_formatted_field PASSED | |
tests/test_schema.py::test_datetime_iso_field PASSED | |
tests/test_schema.py::test_tz_datetime_field PASSED | |
tests/test_schema.py::test_local_datetime_field PASSED | |
tests/test_schema.py::test_class_variable PASSED | |
tests/test_schema.py::test_serialize_many[SchemaClass0] FAILED | |
tests/test_schema.py::test_serialize_many[SchemaClass1] FAILED | |
tests/test_schema.py::test_no_implicit_list_handling FAILED | |
tests/test_schema.py::test_inheriting_serializer PASSED | |
tests/test_schema.py::test_custom_field PASSED | |
tests/test_schema.py::test_url_field PASSED | |
tests/test_schema.py::test_relative_url_field PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass0] PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass1] PASSED | |
tests/test_schema.py::test_default PASSED | |
tests/test_schema.py::test_email_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_email_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_stored_invalid_email PASSED | |
tests/test_schema.py::test_integer_field PASSED | |
tests/test_schema.py::test_integer_default PASSED | |
tests/test_schema.py::test_fixed_field PASSED | |
tests/test_schema.py::test_as_string PASSED | |
tests/test_schema.py::test_decimal_field PASSED | |
tests/test_schema.py::test_price_field PASSED | |
tests/test_schema.py::test_extra PASSED | |
tests/test_schema.py::test_extra_many FAILED | |
tests/test_schema.py::test_method_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_method_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_function_field PASSED | |
tests/test_schema.py::test_prefix[SchemaClass0] PASSED | |
tests/test_schema.py::test_prefix[SchemaClass1] PASSED | |
tests/test_schema.py::test_fields_must_be_declared_as_instances PASSED | |
tests/test_schema.py::test_serializing_generator[SchemaClass0] FAILED | |
tests/test_schema.py::test_serializing_generator[SchemaClass1] FAILED | |
tests/test_schema.py::test_serializing_empty_list_returns_empty_list FAILED | |
tests/test_schema.py::test_serializing_dict PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_invalid_only_param PASSED | |
tests/test_schema.py::test_strict_meta_option PASSED | |
tests/test_schema.py::test_can_serialize_uuid PASSED | |
tests/test_schema.py::test_can_serialize_time PASSED | |
tests/test_schema.py::test_invalid_time PASSED | |
tests/test_schema.py::test_invalid_date PASSED | |
tests/test_schema.py::test_invalid_email PASSED | |
tests/test_schema.py::test_invalid_url PASSED | |
tests/test_schema.py::test_invalid_selection PASSED | |
tests/test_schema.py::test_custom_json PASSED | |
tests/test_schema.py::test_custom_error_message PASSED | |
tests/test_schema.py::test_load_errors_with_many FAILED | |
tests/test_schema.py::test_error_raised_if_fields_option_is_not_list PASSED | |
tests/test_schema.py::test_error_raised_if_additional_option_is_not_list PASSED | |
tests/test_schema.py::test_meta_serializer_fields PASSED | |
tests/test_schema.py::TestFieldOrdering::test_ordering_is_off_by_default PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_exlude_arg_is_maintained PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_load PASSED | |
tests/test_schema.py::test_meta_fields_mapping PASSED | |
tests/test_schema.py::test_meta_field_not_on_obj_raises_attribute_error PASSED | |
tests/test_schema.py::test_exclude_fields PASSED | |
tests/test_schema.py::test_fields_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_exclude_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_dateformat_option PASSED | |
tests/test_schema.py::test_default_dateformat PASSED | |
tests/test_schema.py::test_inherit_meta PASSED | |
tests/test_schema.py::test_inherit_meta_override PASSED | |
tests/test_schema.py::test_additional PASSED | |
tests/test_schema.py::test_cant_set_both_additional_and_fields PASSED | |
tests/test_schema.py::test_serializing_none_meta PASSED | |
tests/test_schema.py::TestErrorHandler::test_dump_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_load_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_multiple_serializers_with_same_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_setting_error_handler_class_attribute PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_on_class PASSED | |
tests/test_schema.py::TestSchemaValidator::test_multiple_schema_errors_can_be_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_with_strict PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_by_decorator PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validators_are_inherited PASSED | |
tests/test_schema.py::TestSchemaValidator::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validation_error_with_error_parameter PASSED | |
tests/test_schema.py::TestSchemaValidator::test_store_schema_validation_errors_on_specified_field PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_on_load PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_after_loading_collection PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_on_class PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_by_decorator PASSED | |
tests/test_schema.py::TestDataHandler::test_schema_with_custom_data_handler PASSED | |
tests/test_schema.py::TestDataHandler::test_serializer_with_multiple_data_handlers PASSED | |
tests/test_schema.py::TestDataHandler::test_setting_data_handlers_class_attribute PASSED | |
tests/test_schema.py::TestDataHandler::test_root_data_handler PASSED | |
tests/test_schema.py::test_schema_repr PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested2 PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_field_does_not_vaidate_required PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_none_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_many_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_meta_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_only PASSED | |
tests/test_schema.py::TestNestedSchema::test_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_only_takes_precedence_over_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_list_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_load_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_errors PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_strict PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_method_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_function_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_many_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_invalid_float_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_meta_with_nested_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_with_nested_meta_fields FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_fields_must_be_passed_a_serializer PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_within_itself PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_by_passing_class_name PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_within_itself_meta PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_self_with_only_param PASSED | |
tests/test_schema.py::TestSelfReference::test_multiple_nested_self_fields PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_many PASSED | |
tests/test_schema.py::test_serialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_none_passed_to_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field_and_custom_validator PASSED | |
tests/test_schema.py::TestContext::test_context_method PASSED | |
tests/test_schema.py::TestContext::test_context_method_function PASSED | |
tests/test_schema.py::TestContext::test_method_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_function_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_fields_context PASSED | |
tests/test_schema.py::TestContext::test_nested_fields_inherit_context PASSED | |
tests/test_schema.py::TestMarshallingError::test_saves_underlying_exception PASSED | |
tests/test_schema.py::test_error_gets_raised_if_many_is_omitted PASSED | |
tests/test_schema.py::test_serializer_can_specify_nested_object_as_attribute PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_non_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inheritance_follows_mro PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_skip_missing_opt PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_missing_values_are_skipped PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_is_used PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_decorator PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_dump_returns_dict PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_load_returns_dict PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_callable_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default_set_to_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_with_uncallable_param PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_email_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_url_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_method_missing PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_uncallable_attribute PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_deserializes_to_iso_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc822] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_rfc_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso8601] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_iso PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_format PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_formattedstring_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field_defaults_to_empty_string PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_time_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_date_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_timedelta_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_select_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_with_error PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_serialize_single_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_none_returns_empty_list_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_allow_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_bad_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_serialize_does_not_apply_validators PASSED | |
tests/test_serialization.py::TestMarshaller::test_prefix PASSED | |
tests/test_serialization.py::TestMarshaller::test_marshalling_generator PASSED | |
tests/test_serialization.py::TestMarshaller::test_default_to_missing PASSED | |
tests/test_serialization.py::test_serializing_named_tuple PASSED | |
tests/test_serialization.py::test_serializing_named_tuple_with_meta PASSED | |
tests/test_utils.py::test_to_marshallable_type PASSED | |
tests/test_utils.py::test_to_marshallable_type_none PASSED | |
tests/test_utils.py::test_to_marshallable_type_with_namedtuple PASSED | |
tests/test_utils.py::test_get_value[obj0] PASSED | |
tests/test_utils.py::test_get_value[obj1] PASSED | |
tests/test_utils.py::test_get_value[obj2] PASSED | |
tests/test_utils.py::test_get_value_default PASSED | |
tests/test_utils.py::test_get_value_for_nested_object PASSED | |
tests/test_utils.py::test_is_keyed_tuple PASSED | |
tests/test_utils.py::test_to_marshallable_type_list PASSED | |
tests/test_utils.py::test_to_marshallable_type_generator PASSED | |
tests/test_utils.py::test_marshallable PASSED | |
tests/test_utils.py::test_is_collection PASSED | |
tests/test_utils.py::test_rfcformat_gmt_naive PASSED | |
tests/test_utils.py::test_rfcformat_central PASSED | |
tests/test_utils.py::test_rfcformat_central_localized PASSED | |
tests/test_utils.py::test_isoformat PASSED | |
tests/test_utils.py::test_isoformat_tzaware PASSED | |
tests/test_utils.py::test_isoformat_localtime PASSED | |
tests/test_utils.py::test_from_datestring PASSED | |
tests/test_utils.py::test_from_rfc[True] PASSED | |
tests/test_utils.py::test_from_rfc[False] PASSED | |
tests/test_utils.py::test_from_iso[True] PASSED | |
tests/test_utils.py::test_from_iso[False] PASSED | |
tests/test_utils.py::test_from_iso_with_tz PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_date[True] PASSED | |
tests/test_utils.py::test_from_iso_date[False] PASSED | |
tests/test_utils.py::test_get_func_name PASSED | |
tests/test_validate.py::test_invalid_email PASSED | |
tests/test_validate.py::test_validate_email_none PASSED | |
tests/test_validate.py::test_validate_url_none PASSED | |
=================================== FAILURES =================================== | |
_________ TestFieldDeserialization.test_empty_datetime_deserialization _________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x7fdebae41950> | |
def test_empty_datetime_deserialization(self): | |
field = fields.DateTime() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:83: Failed | |
________ TestFieldDeserialization.test_empty_time_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x7fdebb3d5fc8> | |
def test_empty_time_field_deserialization(self): | |
field = fields.Time() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:130: Failed | |
________ TestFieldDeserialization.test_empty_date_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x7fdebad2d908> | |
def test_empty_date_field_deserialization(self): | |
field = fields.Date() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:175: Failed | |
_______________ TestSchemaDeserialization.test_deserialize_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x7fdebad36758> | |
def test_deserialize_many(self): | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema(many=True).load(users_data) | |
tests/test_deserialization.py:377: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebad40210> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_make_object_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x7fdebac908c0> | |
def test_make_object_many(self): | |
class SimpleUserSchema3(Schema): | |
name = fields.String() | |
age = fields.Float() | |
def make_object(self, data): | |
return User(**data) | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema3(many=True).load(users_data) | |
tests/test_deserialization.py:407: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebae44e50> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema3.make_object of <SimpleUserSchema3(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______ TestSchemaDeserialization.test_nested_list_deserialization_to_dict ______ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x7fdebae59170> | |
def test_nested_list_deserialization_to_dict(self): | |
class SimpleBlogSerializer(Schema): | |
title = fields.String() | |
authors = fields.Nested(SimpleUserSchema, many=True) | |
blog_dict = { | |
'title': 'Gimme Shelter', | |
'authors': [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
} | |
> result, errors = SimpleBlogSerializer().load(blog_dict) | |
tests/test_deserialization.py:444: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebc662c50> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_strict_mode_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x7fdebacc6638> | |
def test_strict_mode_many(self): | |
bad_data = [ | |
{'email': 'foo@bar.com', 'colors': 'red', 'age': 18}, | |
{'email': 'bad', 'colors': 'pizza', 'age': -1} | |
] | |
v = Validator(strict=True, many=True) | |
with pytest.raises(UnmarshallingError): | |
> v.load(bad_data) | |
tests/test_deserialization.py:503: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebad33cd0> | |
data = [{'age': 18, 'colors': 'red', 'email': 'foo@bar.com'}, {'age': -1, 'colors': 'pizza', 'email': 'bad'}] | |
fields_dict = {'age': <fields.Integer(default=0, attribute=None, error=None, validate=<function <lambda> at 0x7fdebb194c08>, require...ne, required=False)>, 'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method Validator.make_object of <Validator(many=True, strict=True)>>] | |
strict = True, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______________________ test_serialize_many[SchemaClass0] _______________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Mick>, <User Keith>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
______________________ test_serialize_many[SchemaClass1] _______________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Mick>, <User Keith>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list indices must be integers, not str | |
marshmallow/schema.py:632: TypeError | |
________________________ test_no_implicit_list_handling ________________________ | |
recwarn = <_pytest.recwarn.WarningsRecorder instance at 0x7fdebacd6e18> | |
def test_no_implicit_list_handling(recwarn): | |
users = [User(name='Mick'), User(name='Keith')] | |
with pytest.raises(TypeError): | |
UserSchema().dump(users) | |
> w = recwarn.pop() | |
E AssertionError: <type 'exceptions.Warning'> not found in [] | |
tests/test_schema.py:187: AssertionError | |
_______________________________ test_extra_many ________________________________ | |
def test_extra_many(): | |
users = [User('Fred'), User('Brian')] | |
> data, errs = UserSchema(many=True, extra={'band': 'Queen'}).dump(users) | |
tests/test_schema.py:272: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Fred>, <User Brian>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass0] ___________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Foo>, <User Bar>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass1] ___________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Foo>, <User Bar>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list indices must be integers, not str | |
marshmallow/schema.py:632: TypeError | |
________________ test_serializing_empty_list_returns_empty_list ________________ | |
def test_serializing_empty_list_returns_empty_list(): | |
> assert UserSchema(many=True).dump([]).data == [] | |
tests/test_schema.py:309: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
__________________________ test_load_errors_with_many __________________________ | |
def test_load_errors_with_many(): | |
class ErrorSchema(Schema): | |
email = fields.Email() | |
data = [ | |
{'email': 'bademail'}, | |
{'email': 'goo@email.com'}, | |
{'email': 'anotherbademail'}, | |
] | |
> data, errors = ErrorSchema(many=True).load(data) | |
tests/test_schema.py:419: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebad302d0> | |
data = [{'email': 'bademail'}, {'email': 'goo@email.com'}, {'email': 'anotherbademail'}] | |
fields_dict = {'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method ErrorSchema.make_object of <ErrorSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
____________________ TestNestedSchema.test_nested_meta_many ____________________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x7fdebad361b8> | |
blog = <tests.base.Blog object at 0x7fdebad31f90> | |
def test_nested_meta_many(self, blog): | |
serialized_blog = BlogUserMetaSchema().dump(blog)[0] | |
assert len(serialized_blog['collaborators']) == 2 | |
expected = [UserMetaSchema().dump(col)[0] for col in blog.collaborators] | |
> assert serialized_blog['collaborators'] == expected | |
E assert [{'age': 123,...20, 58), ...}] == [{'age': 123, ...+00:00', ...}] | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1070: AssertionError | |
____________________ TestNestedSchema.test_nested_load_many ____________________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x7fdebafa2ea8> | |
def test_nested_load_many(self): | |
in_data = {'title': 'Shine A Light', 'collaborators': [ | |
{'name': 'Mick', 'email': 'mick@stones.com'}, | |
{'name': 'Keith', 'email': 'keith@stones.com'} | |
]} | |
> data, errors = BlogSchema().load(in_data) | |
tests/test_schema.py:1096: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7fdebad221d0> | |
data = [{'email': 'mick@stones.com', 'name': 'Mick'}, {'email': 'keith@stones.com', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'balance': <fields.Pri...ed=False)>, 'created': <fields.DateTime(default=None, attribute=None, error=None, validate=None, required=False)>, ...} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method UserSchema.make_object of <UserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
___________ TestNestedSchema.test_serializer_with_nested_meta_fields ___________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x7fdebaf5bcf8> | |
blog = <tests.base.Blog object at 0x7fdebad21d90> | |
def test_serializer_with_nested_meta_fields(self, blog): | |
# Schema has user = fields.Nested(UserMetaSerializer) | |
s = BlogUserMetaSchema().dump(blog) | |
> assert s.data['user'] == UserMetaSchema().dump(blog.user).data | |
E assert {'age': 81, '... 20, 58), ...} == {'age': 81, 'b...8+00:00', ...} | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1155: AssertionError | |
==================== 18 failed, 369 passed in 3.28 seconds ===================== | |
ERROR: InvocationError: '/home/svenstaro/prj/marshmallow/.tox/py27/bin/python setup.py test' | |
py33 create: /home/svenstaro/prj/marshmallow/.tox/py33 | |
ERROR: InterpreterNotFound: python3.3 | |
py34 inst-nodeps: /home/svenstaro/prj/marshmallow/.tox/dist/marshmallow-1.0.1.zip | |
py34 runtests: PYTHONHASHSEED='2556491626' | |
py34 runtests: commands[0] | flake8 . | |
py34 runtests: commands[1] | /home/svenstaro/prj/marshmallow/.tox/py34/bin/python setup.py test | |
running test | |
running egg_info | |
writing top-level names to marshmallow.egg-info/top_level.txt | |
writing dependency_links to marshmallow.egg-info/dependency_links.txt | |
writing marshmallow.egg-info/PKG-INFO | |
reading manifest file 'marshmallow.egg-info/SOURCES.txt' | |
reading manifest template 'MANIFEST.in' | |
writing manifest file 'marshmallow.egg-info/SOURCES.txt' | |
running build_ext | |
============================= test session starts ============================== | |
platform linux -- Python 3.4.2 -- py-1.4.26 -- pytest-2.6.4 -- /home/svenstaro/prj/marshmallow/.tox/py34/bin/python | |
collecting ... collected 387 items | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization_with_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_integer_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_string_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_arbitrary_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_datetime_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc822] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso8601] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_localdatetime_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_time_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_date_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_price_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_relative_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_email_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_with_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_uuid_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_function_must_be_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_method_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method_must_be_a_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_enum_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_datetime_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_none_to_empty_list PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_single_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_validator_must_return_false_to_raise_error PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_validator_with_nonascii_input PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validators PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_custom_error_message PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_values PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_exclude PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_deserialization_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_list_deserialization_to_dict FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_an_email_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_url_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_required_value_only_passed_to_validators_if_provided PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_strict_mode_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_extra_fields PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_strict_raises_error PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_fields_with_attribute_param PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_function PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_many PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_string_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_method_validator PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass0] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass1] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass2] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass3] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass4] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass5] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass6] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass7] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass8] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass9] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass10] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass11] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass12] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass13] PASSED | |
tests/test_deserialization.py::test_required_enum PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_message_in_list PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_pass_list_of_messages PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_dictionaries PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_store_field_name PASSED | |
tests/test_exceptions.py::TestValidationError::test_str PASSED | |
tests/test_fields.py::TestFieldAliases::test_enum_is_select PASSED | |
tests/test_fields.py::TestFieldAliases::test_int_is_integer PASSED | |
tests/test_fields.py::TestFieldAliases::test_str_is_string PASSED | |
tests/test_fields.py::TestFieldAliases::test_bool_is_boolean PASSED | |
tests/test_fields.py::TestField::test_repr PASSED | |
tests/test_fields.py::TestField::test_error_raised_if_uncallable_validator_passed PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass0] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass1] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass2] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass3] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass4] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass5] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass6] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass7] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass8] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass9] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass10] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass11] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass12] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass13] PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_formatted_string_field PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_enum_field PASSED | |
tests/test_legacy.py::test_serializer_alias PASSED | |
tests/test_legacy.py::test_serializing_through_contructor PASSED | |
tests/test_legacy.py::test_errors_property PASSED | |
tests/test_registry.py::test_serializer_has_class_registry PASSED | |
tests/test_registry.py::test_two_way_nesting PASSED | |
tests/test_registry.py::test_nesting_with_class_name_many PASSED | |
tests/test_registry.py::test_invalid_class_name_in_nested_field_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_same_name_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_all PASSED | |
tests/test_registry.py::test_can_use_full_module_path_to_class PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass0] PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass1] PASSED | |
tests/test_schema.py::test_serializer_dump PASSED | |
tests/test_schema.py::test_dump_returns_dict_of_errors PASSED | |
tests/test_schema.py::test_dump_resets_errors PASSED | |
tests/test_schema.py::test_dump_many PASSED | |
tests/test_schema.py::test_dump_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_many PASSED | |
tests/test_schema.py::test_load_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_load_many PASSED | |
tests/test_schema.py::test_loads_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_loads_many PASSED | |
tests/test_schema.py::test_loads_deserializes_from_json PASSED | |
tests/test_schema.py::test_serializing_none PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass0] PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass1] PASSED | |
tests/test_schema.py::test_dumps_returns_json PASSED | |
tests/test_schema.py::test_naive_datetime_field PASSED | |
tests/test_schema.py::test_datetime_formatted_field PASSED | |
tests/test_schema.py::test_datetime_iso_field PASSED | |
tests/test_schema.py::test_tz_datetime_field PASSED | |
tests/test_schema.py::test_local_datetime_field PASSED | |
tests/test_schema.py::test_class_variable PASSED | |
tests/test_schema.py::test_serialize_many[SchemaClass0] FAILED | |
tests/test_schema.py::test_serialize_many[SchemaClass1] FAILED | |
tests/test_schema.py::test_no_implicit_list_handling PASSED | |
tests/test_schema.py::test_inheriting_serializer PASSED | |
tests/test_schema.py::test_custom_field PASSED | |
tests/test_schema.py::test_url_field PASSED | |
tests/test_schema.py::test_relative_url_field PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass0] PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass1] PASSED | |
tests/test_schema.py::test_default PASSED | |
tests/test_schema.py::test_email_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_email_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_stored_invalid_email PASSED | |
tests/test_schema.py::test_integer_field PASSED | |
tests/test_schema.py::test_integer_default PASSED | |
tests/test_schema.py::test_fixed_field PASSED | |
tests/test_schema.py::test_as_string PASSED | |
tests/test_schema.py::test_decimal_field PASSED | |
tests/test_schema.py::test_price_field PASSED | |
tests/test_schema.py::test_extra PASSED | |
tests/test_schema.py::test_extra_many FAILED | |
tests/test_schema.py::test_method_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_method_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_function_field PASSED | |
tests/test_schema.py::test_prefix[SchemaClass0] PASSED | |
tests/test_schema.py::test_prefix[SchemaClass1] PASSED | |
tests/test_schema.py::test_fields_must_be_declared_as_instances PASSED | |
tests/test_schema.py::test_serializing_generator[SchemaClass0] FAILED | |
tests/test_schema.py::test_serializing_generator[SchemaClass1] FAILED | |
tests/test_schema.py::test_serializing_empty_list_returns_empty_list FAILED | |
tests/test_schema.py::test_serializing_dict PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_invalid_only_param PASSED | |
tests/test_schema.py::test_strict_meta_option PASSED | |
tests/test_schema.py::test_can_serialize_uuid PASSED | |
tests/test_schema.py::test_can_serialize_time PASSED | |
tests/test_schema.py::test_invalid_time PASSED | |
tests/test_schema.py::test_invalid_date PASSED | |
tests/test_schema.py::test_invalid_email PASSED | |
tests/test_schema.py::test_invalid_url PASSED | |
tests/test_schema.py::test_invalid_selection PASSED | |
tests/test_schema.py::test_custom_json PASSED | |
tests/test_schema.py::test_custom_error_message PASSED | |
tests/test_schema.py::test_load_errors_with_many FAILED | |
tests/test_schema.py::test_error_raised_if_fields_option_is_not_list PASSED | |
tests/test_schema.py::test_error_raised_if_additional_option_is_not_list PASSED | |
tests/test_schema.py::test_meta_serializer_fields PASSED | |
tests/test_schema.py::TestFieldOrdering::test_ordering_is_off_by_default PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_exlude_arg_is_maintained PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_load PASSED | |
tests/test_schema.py::test_meta_fields_mapping PASSED | |
tests/test_schema.py::test_meta_field_not_on_obj_raises_attribute_error PASSED | |
tests/test_schema.py::test_exclude_fields PASSED | |
tests/test_schema.py::test_fields_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_exclude_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_dateformat_option PASSED | |
tests/test_schema.py::test_default_dateformat PASSED | |
tests/test_schema.py::test_inherit_meta PASSED | |
tests/test_schema.py::test_inherit_meta_override PASSED | |
tests/test_schema.py::test_additional PASSED | |
tests/test_schema.py::test_cant_set_both_additional_and_fields PASSED | |
tests/test_schema.py::test_serializing_none_meta PASSED | |
tests/test_schema.py::TestErrorHandler::test_dump_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_load_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_multiple_serializers_with_same_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_setting_error_handler_class_attribute PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_on_class PASSED | |
tests/test_schema.py::TestSchemaValidator::test_multiple_schema_errors_can_be_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_with_strict PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_by_decorator PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validators_are_inherited PASSED | |
tests/test_schema.py::TestSchemaValidator::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validation_error_with_error_parameter PASSED | |
tests/test_schema.py::TestSchemaValidator::test_store_schema_validation_errors_on_specified_field PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_on_load PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_after_loading_collection PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_on_class PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_by_decorator PASSED | |
tests/test_schema.py::TestDataHandler::test_schema_with_custom_data_handler PASSED | |
tests/test_schema.py::TestDataHandler::test_serializer_with_multiple_data_handlers PASSED | |
tests/test_schema.py::TestDataHandler::test_setting_data_handlers_class_attribute PASSED | |
tests/test_schema.py::TestDataHandler::test_root_data_handler PASSED | |
tests/test_schema.py::test_schema_repr PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested2 PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_field_does_not_vaidate_required PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_none_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_many_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_meta_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_only PASSED | |
tests/test_schema.py::TestNestedSchema::test_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_only_takes_precedence_over_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_list_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_load_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_errors PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_strict PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_method_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_function_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_many_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_invalid_float_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_meta_with_nested_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_with_nested_meta_fields FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_fields_must_be_passed_a_serializer PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_within_itself PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_by_passing_class_name PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_within_itself_meta PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_self_with_only_param PASSED | |
tests/test_schema.py::TestSelfReference::test_multiple_nested_self_fields PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_many PASSED | |
tests/test_schema.py::test_serialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_none_passed_to_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field_and_custom_validator PASSED | |
tests/test_schema.py::TestContext::test_context_method PASSED | |
tests/test_schema.py::TestContext::test_context_method_function PASSED | |
tests/test_schema.py::TestContext::test_method_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_function_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_fields_context PASSED | |
tests/test_schema.py::TestContext::test_nested_fields_inherit_context PASSED | |
tests/test_schema.py::TestMarshallingError::test_saves_underlying_exception PASSED | |
tests/test_schema.py::test_error_gets_raised_if_many_is_omitted PASSED | |
tests/test_schema.py::test_serializer_can_specify_nested_object_as_attribute PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_non_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inheritance_follows_mro PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_skip_missing_opt PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_missing_values_are_skipped PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_is_used PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_decorator PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_dump_returns_dict PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_load_returns_dict PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_callable_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default_set_to_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_with_uncallable_param PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_email_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_url_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_method_missing PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_uncallable_attribute PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_deserializes_to_iso_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc822] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_rfc_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso8601] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_iso PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_format PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_formattedstring_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field_defaults_to_empty_string PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_time_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_date_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_timedelta_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_select_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_with_error PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_serialize_single_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_none_returns_empty_list_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_allow_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_bad_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_serialize_does_not_apply_validators PASSED | |
tests/test_serialization.py::TestMarshaller::test_prefix PASSED | |
tests/test_serialization.py::TestMarshaller::test_marshalling_generator PASSED | |
tests/test_serialization.py::TestMarshaller::test_default_to_missing PASSED | |
tests/test_serialization.py::test_serializing_named_tuple PASSED | |
tests/test_serialization.py::test_serializing_named_tuple_with_meta PASSED | |
tests/test_utils.py::test_to_marshallable_type PASSED | |
tests/test_utils.py::test_to_marshallable_type_none PASSED | |
tests/test_utils.py::test_to_marshallable_type_with_namedtuple PASSED | |
tests/test_utils.py::test_get_value[obj0] PASSED | |
tests/test_utils.py::test_get_value[obj1] PASSED | |
tests/test_utils.py::test_get_value[obj2] PASSED | |
tests/test_utils.py::test_get_value_default PASSED | |
tests/test_utils.py::test_get_value_for_nested_object PASSED | |
tests/test_utils.py::test_is_keyed_tuple PASSED | |
tests/test_utils.py::test_to_marshallable_type_list PASSED | |
tests/test_utils.py::test_to_marshallable_type_generator PASSED | |
tests/test_utils.py::test_marshallable PASSED | |
tests/test_utils.py::test_is_collection PASSED | |
tests/test_utils.py::test_rfcformat_gmt_naive PASSED | |
tests/test_utils.py::test_rfcformat_central PASSED | |
tests/test_utils.py::test_rfcformat_central_localized PASSED | |
tests/test_utils.py::test_isoformat PASSED | |
tests/test_utils.py::test_isoformat_tzaware PASSED | |
tests/test_utils.py::test_isoformat_localtime PASSED | |
tests/test_utils.py::test_from_datestring PASSED | |
tests/test_utils.py::test_from_rfc[True] PASSED | |
tests/test_utils.py::test_from_rfc[False] PASSED | |
tests/test_utils.py::test_from_iso[True] PASSED | |
tests/test_utils.py::test_from_iso[False] PASSED | |
tests/test_utils.py::test_from_iso_with_tz PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_date[True] PASSED | |
tests/test_utils.py::test_from_iso_date[False] PASSED | |
tests/test_utils.py::test_get_func_name PASSED | |
tests/test_validate.py::test_invalid_email PASSED | |
tests/test_validate.py::test_validate_email_none PASSED | |
tests/test_validate.py::test_validate_url_none PASSED | |
=================================== FAILURES =================================== | |
_________ TestFieldDeserialization.test_empty_datetime_deserialization _________ | |
self = <tests.test_deserialization.TestFieldDeserialization object at 0x7f1d04575940> | |
def test_empty_datetime_deserialization(self): | |
field = fields.DateTime() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:83: Failed | |
________ TestFieldDeserialization.test_empty_time_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization object at 0x7f1d044f8400> | |
def test_empty_time_field_deserialization(self): | |
field = fields.Time() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:130: Failed | |
________ TestFieldDeserialization.test_empty_date_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization object at 0x7f1d045758d0> | |
def test_empty_date_field_deserialization(self): | |
field = fields.Date() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:175: Failed | |
_______________ TestSchemaDeserialization.test_deserialize_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization object at 0x7f1d044f8e48> | |
def test_deserialize_many(self): | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema(many=True).load(users_data) | |
tests/test_deserialization.py:377: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d044f8f28> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_make_object_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization object at 0x7f1d04686048> | |
def test_make_object_many(self): | |
class SimpleUserSchema3(Schema): | |
name = fields.String() | |
age = fields.Float() | |
def make_object(self, data): | |
return User(**data) | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema3(many=True).load(users_data) | |
tests/test_deserialization.py:407: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d0468c4e0> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema3.make_object of <SimpleUserSchema3(many=True, strict=False)>>] | |
strict = False, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______ TestSchemaDeserialization.test_nested_list_deserialization_to_dict ______ | |
self = <tests.test_deserialization.TestSchemaDeserialization object at 0x7f1d043f6748> | |
def test_nested_list_deserialization_to_dict(self): | |
class SimpleBlogSerializer(Schema): | |
title = fields.String() | |
authors = fields.Nested(SimpleUserSchema, many=True) | |
blog_dict = { | |
'title': 'Gimme Shelter', | |
'authors': [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
} | |
> result, errors = SimpleBlogSerializer().load(blog_dict) | |
tests/test_deserialization.py:444: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d043f6b38> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_strict_mode_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization object at 0x7f1d0442b0f0> | |
def test_strict_mode_many(self): | |
bad_data = [ | |
{'email': 'foo@bar.com', 'colors': 'red', 'age': 18}, | |
{'email': 'bad', 'colors': 'pizza', 'age': -1} | |
] | |
v = Validator(strict=True, many=True) | |
with pytest.raises(UnmarshallingError): | |
> v.load(bad_data) | |
tests/test_deserialization.py:503: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d0442b8d0> | |
data = [{'age': 18, 'colors': 'red', 'email': 'foo@bar.com'}, {'age': -1, 'colors': 'pizza', 'email': 'bad'}] | |
fields_dict = {'age': <fields.Integer(default=0, attribute=None, error=None, validate=<function Validator.<lambda> at 0x7f1d046d6400...ne, required=False)>, 'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method Validator.make_object of <Validator(many=True, strict=True)>>] | |
strict = True, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______________________ test_serialize_many[SchemaClass0] _______________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'created', obj = [<User Mick>, <User Keith>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
______________________ test_serialize_many[SchemaClass1] _______________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Mick>, <User Keith>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list indices must be integers, not str | |
marshmallow/schema.py:632: TypeError | |
_______________________________ test_extra_many ________________________________ | |
def test_extra_many(): | |
users = [User('Fred'), User('Brian')] | |
> data, errs = UserSchema(many=True, extra={'band': 'Queen'}).dump(users) | |
tests/test_schema.py:272: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'created', obj = [<User Fred>, <User Brian>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass0] ___________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'created', obj = [<User Foo>, <User Bar>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass1] ___________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Foo>, <User Bar>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list indices must be integers, not str | |
marshmallow/schema.py:632: TypeError | |
________________ test_serializing_empty_list_returns_empty_list ________________ | |
def test_serializing_empty_list_returns_empty_list(): | |
> assert UserSchema(many=True).dump([]).data == [] | |
tests/test_schema.py:309: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'created', obj = [], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list indices must be integers, not str | |
marshmallow/utils.py:304: TypeError | |
__________________________ test_load_errors_with_many __________________________ | |
def test_load_errors_with_many(): | |
class ErrorSchema(Schema): | |
email = fields.Email() | |
data = [ | |
{'email': 'bademail'}, | |
{'email': 'goo@email.com'}, | |
{'email': 'anotherbademail'}, | |
] | |
> data, errors = ErrorSchema(many=True).load(data) | |
tests/test_schema.py:419: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d04489f98> | |
data = [{'email': 'bademail'}, {'email': 'goo@email.com'}, {'email': 'anotherbademail'}] | |
fields_dict = {'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method ErrorSchema.make_object of <ErrorSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
____________________ TestNestedSchema.test_nested_meta_many ____________________ | |
self = <tests.test_schema.TestNestedSchema object at 0x7f1d046280b8> | |
blog = <tests.base.Blog object at 0x7f1d043f52e8> | |
def test_nested_meta_many(self, blog): | |
serialized_blog = BlogUserMetaSchema().dump(blog)[0] | |
assert len(serialized_blog['collaborators']) == 2 | |
expected = [UserMetaSchema().dump(col)[0] for col in blog.collaborators] | |
> assert serialized_blog['collaborators'] == expected | |
E assert [{'age': 123,...20, 58), ...}] == [{'age': 123, ...+00:00', ...}] | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1070: AssertionError | |
____________________ TestNestedSchema.test_nested_load_many ____________________ | |
self = <tests.test_schema.TestNestedSchema object at 0x7f1d045f7e80> | |
def test_nested_load_many(self): | |
in_data = {'title': 'Shine A Light', 'collaborators': [ | |
{'name': 'Mick', 'email': 'mick@stones.com'}, | |
{'name': 'Keith', 'email': 'keith@stones.com'} | |
]} | |
> data, errors = BlogSchema().load(in_data) | |
tests/test_schema.py:1096: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x7f1d04203ef0> | |
data = [{'email': 'mick@stones.com', 'name': 'Mick'}, {'email': 'keith@stones.com', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'balance': <fields.Pri...ed=False)>, 'created': <fields.DateTime(default=None, attribute=None, error=None, validate=None, required=False)>, ...} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method UserSchema.make_object of <UserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <class 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
___________ TestNestedSchema.test_serializer_with_nested_meta_fields ___________ | |
self = <tests.test_schema.TestNestedSchema object at 0x7f1d0428d390> | |
blog = <tests.base.Blog object at 0x7f1d043722b0> | |
def test_serializer_with_nested_meta_fields(self, blog): | |
# Schema has user = fields.Nested(UserMetaSerializer) | |
s = BlogUserMetaSchema().dump(blog) | |
> assert s.data['user'] == UserMetaSchema().dump(blog.user).data | |
E assert {'age': 81, '... 20, 58), ...} == {'age': 81, 'b...8+00:00', ...} | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1155: AssertionError | |
==================== 17 failed, 370 passed in 3.29 seconds ===================== | |
ERROR: InvocationError: '/home/svenstaro/prj/marshmallow/.tox/py34/bin/python setup.py test' | |
pypy inst-nodeps: /home/svenstaro/prj/marshmallow/.tox/dist/marshmallow-1.0.1.zip | |
pypy runtests: PYTHONHASHSEED='2556491626' | |
pypy runtests: commands[0] | flake8 . | |
pypy runtests: commands[1] | /home/svenstaro/prj/marshmallow/.tox/pypy/bin/python setup.py test | |
running test | |
running egg_info | |
writing marshmallow.egg-info/PKG-INFO | |
writing top-level names to marshmallow.egg-info/top_level.txt | |
writing dependency_links to marshmallow.egg-info/dependency_links.txt | |
reading manifest file 'marshmallow.egg-info/SOURCES.txt' | |
reading manifest template 'MANIFEST.in' | |
writing manifest file 'marshmallow.egg-info/SOURCES.txt' | |
running build_ext | |
============================= test session starts ============================== | |
platform linux2 -- Python 2.7.8[pypy-2.4.0-final] -- py-1.4.26 -- pytest-2.6.4 -- /home/svenstaro/prj/marshmallow/.tox/pypy/bin/python | |
collecting ... collected 387 items | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_float_field_deserialization_with_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_integer_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_string_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_boolean_field_deserialization_with_custom_truthy_values PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_arbitrary_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_datetime_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_datetime_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_rfc_datetime_field_deserialization[rfc822] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_iso_datetime_field_deserialization[iso8601] PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_localdatetime_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_time_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_time_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_timedelta_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_invalid_date_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_empty_date_field_deserialization FAILED | |
tests/test_deserialization.py::TestFieldDeserialization::test_price_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_relative_url_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_email_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_function_field_deserialization_with_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_uuid_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_function_must_be_callable PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_method_field_deserialization_is_noop_by_default PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_deserialization_method_must_be_a_method PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_enum_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_fixed_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_datetime_list_field_deserialization PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_none_to_empty_list PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_single_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_list_field_deserialize_invalid_value PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validator PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_validator_must_return_false_to_raise_error PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_validator_with_nonascii_input PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_user_validators PASSED | |
tests/test_deserialization.py::TestFieldDeserialization::test_field_deserialization_with_custom_error_message PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_missing_values PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_make_object_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_exclude PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_single_deserialization_to_dict PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_nested_list_deserialization_to_dict FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialize_with_attribute_param PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_deserialization_returns_errors_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_many FAILED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_strict_mode_deserialization_with_multiple_validators PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_an_email_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_multiple_errors_can_be_stored_for_a_url_field PASSED | |
tests/test_deserialization.py::TestSchemaDeserialization::test_required_value_only_passed_to_validators_if_provided PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_strict_mode_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_extra_fields PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_many PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_strict_raises_error PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_stores_errors PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_deserialize_fields_with_attribute_param PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_function PASSED | |
tests/test_deserialization.py::TestUnMarshaller::test_preprocessing_many PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_integer_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_float_with_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_string_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validator PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field0] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field1] PASSED | |
tests/test_deserialization.py::TestValidation::test_function_validators[field2] PASSED | |
tests/test_deserialization.py::TestValidation::test_method_validator PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass0] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass1] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass2] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass3] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass4] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass5] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass6] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass7] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass8] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass9] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass10] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass11] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass12] PASSED | |
tests/test_deserialization.py::test_required_field_failure[FieldClass13] PASSED | |
tests/test_deserialization.py::test_required_enum PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_message_in_list PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_pass_list_of_messages PASSED | |
tests/test_exceptions.py::TestValidationError::test_stores_dictionaries PASSED | |
tests/test_exceptions.py::TestValidationError::test_can_store_field_name PASSED | |
tests/test_exceptions.py::TestValidationError::test_str PASSED | |
tests/test_fields.py::TestFieldAliases::test_enum_is_select PASSED | |
tests/test_fields.py::TestFieldAliases::test_int_is_integer PASSED | |
tests/test_fields.py::TestFieldAliases::test_str_is_string PASSED | |
tests/test_fields.py::TestFieldAliases::test_bool_is_boolean PASSED | |
tests/test_fields.py::TestField::test_repr PASSED | |
tests/test_fields.py::TestField::test_error_raised_if_uncallable_validator_passed PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass0] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass1] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass2] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass3] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass4] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass5] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass6] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass7] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass8] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass9] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass10] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass11] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass12] PASSED | |
tests/test_fields.py::TestMetadata::test_extra_metadata_may_be_added_to_field[FieldClass13] PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_formatted_string_field PASSED | |
tests/test_fields.py::TestMetadata::test_metadata_may_be_added_to_enum_field PASSED | |
tests/test_legacy.py::test_serializer_alias PASSED | |
tests/test_legacy.py::test_serializing_through_contructor PASSED | |
tests/test_legacy.py::test_errors_property PASSED | |
tests/test_registry.py::test_serializer_has_class_registry PASSED | |
tests/test_registry.py::test_two_way_nesting PASSED | |
tests/test_registry.py::test_nesting_with_class_name_many PASSED | |
tests/test_registry.py::test_invalid_class_name_in_nested_field_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_same_name_raises_error PASSED | |
tests/test_registry.py::test_multiple_classes_with_all PASSED | |
tests/test_registry.py::test_can_use_full_module_path_to_class PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass0] PASSED | |
tests/test_schema.py::test_serializing_basic_object[SchemaClass1] PASSED | |
tests/test_schema.py::test_serializer_dump PASSED | |
tests/test_schema.py::test_dump_returns_dict_of_errors PASSED | |
tests/test_schema.py::test_dump_resets_errors PASSED | |
tests/test_schema.py::test_dump_many PASSED | |
tests/test_schema.py::test_dump_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_returns_a_marshalresult PASSED | |
tests/test_schema.py::test_dumps_many PASSED | |
tests/test_schema.py::test_load_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_load_many PASSED | |
tests/test_schema.py::test_loads_returns_an_unmarshalresult PASSED | |
tests/test_schema.py::test_loads_many PASSED | |
tests/test_schema.py::test_loads_deserializes_from_json PASSED | |
tests/test_schema.py::test_serializing_none PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass0] PASSED | |
tests/test_schema.py::test_fields_are_not_copies[SchemaClass1] PASSED | |
tests/test_schema.py::test_dumps_returns_json PASSED | |
tests/test_schema.py::test_naive_datetime_field PASSED | |
tests/test_schema.py::test_datetime_formatted_field PASSED | |
tests/test_schema.py::test_datetime_iso_field PASSED | |
tests/test_schema.py::test_tz_datetime_field PASSED | |
tests/test_schema.py::test_local_datetime_field PASSED | |
tests/test_schema.py::test_class_variable PASSED | |
tests/test_schema.py::test_serialize_many[SchemaClass0] FAILED | |
tests/test_schema.py::test_serialize_many[SchemaClass1] FAILED | |
tests/test_schema.py::test_no_implicit_list_handling FAILED | |
tests/test_schema.py::test_inheriting_serializer PASSED | |
tests/test_schema.py::test_custom_field PASSED | |
tests/test_schema.py::test_url_field PASSED | |
tests/test_schema.py::test_relative_url_field PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass0] PASSED | |
tests/test_schema.py::test_stores_invalid_url_error[SchemaClass1] PASSED | |
tests/test_schema.py::test_default PASSED | |
tests/test_schema.py::test_email_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_email_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_stored_invalid_email PASSED | |
tests/test_schema.py::test_integer_field PASSED | |
tests/test_schema.py::test_integer_default PASSED | |
tests/test_schema.py::test_fixed_field PASSED | |
tests/test_schema.py::test_as_string PASSED | |
tests/test_schema.py::test_decimal_field PASSED | |
tests/test_schema.py::test_price_field PASSED | |
tests/test_schema.py::test_extra PASSED | |
tests/test_schema.py::test_extra_many FAILED | |
tests/test_schema.py::test_method_field[SchemaClass0] PASSED | |
tests/test_schema.py::test_method_field[SchemaClass1] PASSED | |
tests/test_schema.py::test_function_field PASSED | |
tests/test_schema.py::test_prefix[SchemaClass0] PASSED | |
tests/test_schema.py::test_prefix[SchemaClass1] PASSED | |
tests/test_schema.py::test_fields_must_be_declared_as_instances PASSED | |
tests/test_schema.py::test_serializing_generator[SchemaClass0] FAILED | |
tests/test_schema.py::test_serializing_generator[SchemaClass1] FAILED | |
tests/test_schema.py::test_serializing_empty_list_returns_empty_list FAILED | |
tests/test_schema.py::test_serializing_dict PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_exclude_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass0] PASSED | |
tests/test_schema.py::test_only_in_init[SchemaClass1] PASSED | |
tests/test_schema.py::test_invalid_only_param PASSED | |
tests/test_schema.py::test_strict_meta_option PASSED | |
tests/test_schema.py::test_can_serialize_uuid PASSED | |
tests/test_schema.py::test_can_serialize_time PASSED | |
tests/test_schema.py::test_invalid_time PASSED | |
tests/test_schema.py::test_invalid_date PASSED | |
tests/test_schema.py::test_invalid_email PASSED | |
tests/test_schema.py::test_invalid_url PASSED | |
tests/test_schema.py::test_invalid_selection PASSED | |
tests/test_schema.py::test_custom_json PASSED | |
tests/test_schema.py::test_custom_error_message PASSED | |
tests/test_schema.py::test_load_errors_with_many FAILED | |
tests/test_schema.py::test_error_raised_if_fields_option_is_not_list PASSED | |
tests/test_schema.py::test_error_raised_if_additional_option_is_not_list PASSED | |
tests/test_schema.py::test_meta_serializer_fields PASSED | |
tests/test_schema.py::TestFieldOrdering::test_ordering_is_off_by_default PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_declared_field_order_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_only_arg_is_maintained_on_load PASSED | |
tests/test_schema.py::TestFieldOrdering::test_nested_field_order_with_exlude_arg_is_maintained PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_dump PASSED | |
tests/test_schema.py::TestFieldOrdering::test_meta_fields_order_is_maintained_on_load PASSED | |
tests/test_schema.py::test_meta_fields_mapping PASSED | |
tests/test_schema.py::test_meta_field_not_on_obj_raises_attribute_error PASSED | |
tests/test_schema.py::test_exclude_fields PASSED | |
tests/test_schema.py::test_fields_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_exclude_option_must_be_list_or_tuple PASSED | |
tests/test_schema.py::test_dateformat_option PASSED | |
tests/test_schema.py::test_default_dateformat PASSED | |
tests/test_schema.py::test_inherit_meta PASSED | |
tests/test_schema.py::test_inherit_meta_override PASSED | |
tests/test_schema.py::test_additional PASSED | |
tests/test_schema.py::test_cant_set_both_additional_and_fields PASSED | |
tests/test_schema.py::test_serializing_none_meta PASSED | |
tests/test_schema.py::TestErrorHandler::test_dump_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_load_with_custom_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_multiple_serializers_with_same_error_handler PASSED | |
tests/test_schema.py::TestErrorHandler::test_setting_error_handler_class_attribute PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_on_class PASSED | |
tests/test_schema.py::TestSchemaValidator::test_multiple_schema_errors_can_be_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_with_strict PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validator_defined_by_decorator PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validators_are_inherited PASSED | |
tests/test_schema.py::TestSchemaValidator::test_uncaught_validation_errors_are_stored PASSED | |
tests/test_schema.py::TestSchemaValidator::test_validation_error_with_error_parameter PASSED | |
tests/test_schema.py::TestSchemaValidator::test_store_schema_validation_errors_on_specified_field PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_on_load PASSED | |
tests/test_schema.py::TestSchemaValidator::test_errors_are_cleared_after_loading_collection PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_on_class PASSED | |
tests/test_schema.py::TestPreprocessors::test_preprocessors_defined_by_decorator PASSED | |
tests/test_schema.py::TestDataHandler::test_schema_with_custom_data_handler PASSED | |
tests/test_schema.py::TestDataHandler::test_serializer_with_multiple_data_handlers PASSED | |
tests/test_schema.py::TestDataHandler::test_setting_data_handlers_class_attribute PASSED | |
tests/test_schema.py::TestDataHandler::test_root_data_handler PASSED | |
tests/test_schema.py::test_schema_repr PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_flat_nested2 PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_field_does_not_vaidate_required PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_none_default PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_many_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_meta_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_only PASSED | |
tests/test_schema.py::TestNestedSchema::test_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_only_takes_precedence_over_exclude PASSED | |
tests/test_schema.py::TestNestedSchema::test_list_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_load_many FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_errors PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_strict PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_method_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_function_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_nested_prefixed_many_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_invalid_float_field PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_meta_with_nested_fields PASSED | |
tests/test_schema.py::TestNestedSchema::test_serializer_with_nested_meta_fields FAILED | |
tests/test_schema.py::TestNestedSchema::test_nested_fields_must_be_passed_a_serializer PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_within_itself PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_schema_by_passing_class_name PASSED | |
tests/test_schema.py::TestSelfReference::test_nesting_within_itself_meta PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_self_with_only_param PASSED | |
tests/test_schema.py::TestSelfReference::test_multiple_nested_self_fields PASSED | |
tests/test_schema.py::TestSelfReference::test_nested_many PASSED | |
tests/test_schema.py::test_serialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_none_passed_to_required_field PASSED | |
tests/test_schema.py::test_deserialization_with_required_field_and_custom_validator PASSED | |
tests/test_schema.py::TestContext::test_context_method PASSED | |
tests/test_schema.py::TestContext::test_context_method_function PASSED | |
tests/test_schema.py::TestContext::test_method_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_function_field_raises_error_when_context_not_available PASSED | |
tests/test_schema.py::TestContext::test_fields_context PASSED | |
tests/test_schema.py::TestContext::test_nested_fields_inherit_context PASSED | |
tests/test_schema.py::TestMarshallingError::test_saves_underlying_exception PASSED | |
tests/test_schema.py::test_error_gets_raised_if_many_is_omitted PASSED | |
tests/test_schema.py::test_serializer_can_specify_nested_object_as_attribute PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inherit_fields_from_non_schema_subclass PASSED | |
tests/test_schema.py::TestFieldInheritance::test_inheritance_follows_mro PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_skip_missing_opt PASSED | |
tests/test_schema.py::TestSkipMissingOption::test_missing_values_are_skipped PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_is_used PASSED | |
tests/test_schema.py::TestAccessor::test_accessor_decorator PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_dump_returns_dict PASSED | |
tests/test_schema.py::TestUnordered::test_unordered_load_returns_dict PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_callable_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_integer_field_default_set_to_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_function_with_uncallable_param PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_email_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_url_field_validates PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_method_missing PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_method_field_with_uncallable_attribute PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_deserializes_to_iso_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_field_rfc822[rfc822] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_rfc_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_iso8601[iso8601] PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_localdatetime_iso PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_format PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_formattedstring_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_string_field_defaults_to_empty_string PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_time_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_date_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_timedelta_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_select_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_with_error PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_datetime_list_serialize_single_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_none_returns_empty_list_by_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_list_field_serialize_allow_none PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_bad_list_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_arbitrary_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_fixed_field_invalid_value PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_price_field_default PASSED | |
tests/test_serialization.py::TestFieldSerialization::test_serialize_does_not_apply_validators PASSED | |
tests/test_serialization.py::TestMarshaller::test_prefix PASSED | |
tests/test_serialization.py::TestMarshaller::test_marshalling_generator PASSED | |
tests/test_serialization.py::TestMarshaller::test_default_to_missing PASSED | |
tests/test_serialization.py::test_serializing_named_tuple PASSED | |
tests/test_serialization.py::test_serializing_named_tuple_with_meta PASSED | |
tests/test_utils.py::test_to_marshallable_type PASSED | |
tests/test_utils.py::test_to_marshallable_type_none PASSED | |
tests/test_utils.py::test_to_marshallable_type_with_namedtuple PASSED | |
tests/test_utils.py::test_get_value[obj0] PASSED | |
tests/test_utils.py::test_get_value[obj1] PASSED | |
tests/test_utils.py::test_get_value[obj2] PASSED | |
tests/test_utils.py::test_get_value_default PASSED | |
tests/test_utils.py::test_get_value_for_nested_object PASSED | |
tests/test_utils.py::test_is_keyed_tuple PASSED | |
tests/test_utils.py::test_to_marshallable_type_list PASSED | |
tests/test_utils.py::test_to_marshallable_type_generator PASSED | |
tests/test_utils.py::test_marshallable PASSED | |
tests/test_utils.py::test_is_collection PASSED | |
tests/test_utils.py::test_rfcformat_gmt_naive PASSED | |
tests/test_utils.py::test_rfcformat_central PASSED | |
tests/test_utils.py::test_rfcformat_central_localized PASSED | |
tests/test_utils.py::test_isoformat PASSED | |
tests/test_utils.py::test_isoformat_tzaware PASSED | |
tests/test_utils.py::test_isoformat_localtime PASSED | |
tests/test_utils.py::test_from_datestring PASSED | |
tests/test_utils.py::test_from_rfc[True] PASSED | |
tests/test_utils.py::test_from_rfc[False] PASSED | |
tests/test_utils.py::test_from_iso[True] PASSED | |
tests/test_utils.py::test_from_iso[False] PASSED | |
tests/test_utils.py::test_from_iso_with_tz PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_with_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[True] PASSED | |
tests/test_utils.py::test_from_iso_time_without_microseconds[False] PASSED | |
tests/test_utils.py::test_from_iso_date[True] PASSED | |
tests/test_utils.py::test_from_iso_date[False] PASSED | |
tests/test_utils.py::test_get_func_name PASSED | |
tests/test_validate.py::test_invalid_email PASSED | |
tests/test_validate.py::test_validate_email_none PASSED | |
tests/test_validate.py::test_validate_url_none PASSED | |
=================================== FAILURES =================================== | |
_________ TestFieldDeserialization.test_empty_datetime_deserialization _________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x0000000004aacb40> | |
def test_empty_datetime_deserialization(self): | |
field = fields.DateTime() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:83: Failed | |
________ TestFieldDeserialization.test_empty_time_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x0000000003b3d380> | |
def test_empty_time_field_deserialization(self): | |
field = fields.Time() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:130: Failed | |
________ TestFieldDeserialization.test_empty_date_field_deserialization ________ | |
self = <tests.test_deserialization.TestFieldDeserialization instance at 0x00000000034b50a0> | |
def test_empty_date_field_deserialization(self): | |
field = fields.Date() | |
with pytest.raises(UnmarshallingError): | |
> field.deserialize('') | |
E Failed: DID NOT RAISE | |
tests/test_deserialization.py:175: Failed | |
_______________ TestSchemaDeserialization.test_deserialize_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x0000000002c0b460> | |
def test_deserialize_many(self): | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema(many=True).load(users_data) | |
tests/test_deserialization.py:377: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x0000000003586d08> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_make_object_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x00000000029a0820> | |
def test_make_object_many(self): | |
class SimpleUserSchema3(Schema): | |
name = fields.String() | |
age = fields.Float() | |
def make_object(self, data): | |
return User(**data) | |
users_data = [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
> result, errors = SimpleUserSchema3(many=True).load(users_data) | |
tests/test_deserialization.py:407: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x0000000002985360> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema3.make_object of <SimpleUserSchema3(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______ TestSchemaDeserialization.test_nested_list_deserialization_to_dict ______ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x00000000044de560> | |
def test_nested_list_deserialization_to_dict(self): | |
class SimpleBlogSerializer(Schema): | |
title = fields.String() | |
authors = fields.Nested(SimpleUserSchema, many=True) | |
blog_dict = { | |
'title': 'Gimme Shelter', | |
'authors': [ | |
{'name': 'Mick', 'age': '914'}, | |
{'name': 'Keith', 'age': '8442'} | |
] | |
} | |
> result, errors = SimpleBlogSerializer().load(blog_dict) | |
tests/test_deserialization.py:444: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x0000000003652138> | |
data = [{'age': '914', 'name': 'Mick'}, {'age': '8442', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'name': <fields.String(default='', attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method SimpleUserSchema.make_object of <SimpleUserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
_______________ TestSchemaDeserialization.test_strict_mode_many ________________ | |
self = <tests.test_deserialization.TestSchemaDeserialization instance at 0x0000000002f9f240> | |
def test_strict_mode_many(self): | |
bad_data = [ | |
{'email': 'foo@bar.com', 'colors': 'red', 'age': 18}, | |
{'email': 'bad', 'colors': 'pizza', 'age': -1} | |
] | |
v = Validator(strict=True, many=True) | |
with pytest.raises(UnmarshallingError): | |
> v.load(bad_data) | |
tests/test_deserialization.py:503: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x0000000002ce5d70> | |
data = [{'age': 18, 'colors': 'red', 'email': 'foo@bar.com'}, {'age': -1, 'colors': 'pizza', 'email': 'bad'}] | |
fields_dict = {'age': <fields.Integer(default=0, attribute=None, error=None, validate=<function <lambda> at 0x0000000003409088>, req...ne, required=False)>, 'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method Validator.make_object of <Validator(many=True, strict=True)>>] | |
strict = True, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
______________________ test_serialize_many[SchemaClass0] _______________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Mick>, <User Keith>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list index must be an integer, not str | |
marshmallow/utils.py:304: TypeError | |
______________________ test_serialize_many[SchemaClass1] _______________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serialize_many(SchemaClass): | |
user1 = User(name="Mick", age=123) | |
user2 = User(name="Keith", age=456) | |
users = [user1, user2] | |
> serialized = SchemaClass(many=True).dump(users) | |
tests/test_schema.py:178: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Mick>, <User Keith>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list index must be an integer, not str | |
marshmallow/schema.py:632: TypeError | |
________________________ test_no_implicit_list_handling ________________________ | |
recwarn = <_pytest.recwarn.WarningsRecorder instance at 0x0000000005b249a0> | |
def test_no_implicit_list_handling(recwarn): | |
users = [User(name='Mick'), User(name='Keith')] | |
with pytest.raises(TypeError): | |
UserSchema().dump(users) | |
> w = recwarn.pop() | |
E AssertionError: <type 'exceptions.Warning'> not found in [] | |
tests/test_schema.py:187: AssertionError | |
_______________________________ test_extra_many ________________________________ | |
def test_extra_many(): | |
users = [User('Fred'), User('Brian')] | |
> data, errs = UserSchema(many=True, extra={'band': 'Queen'}).dump(users) | |
tests/test_schema.py:272: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Fred>, <User Brian>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list index must be an integer, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass0] ___________________ | |
SchemaClass = <class 'tests.base.UserSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [<User Foo>, <User Bar>], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list index must be an integer, not str | |
marshmallow/utils.py:304: TypeError | |
___________________ test_serializing_generator[SchemaClass1] ___________________ | |
SchemaClass = <class 'tests.base.UserMetaSchema'> | |
@pytest.mark.parametrize('SchemaClass', | |
[UserSchema, UserMetaSchema]) | |
def test_serializing_generator(SchemaClass): | |
users = [User("Foo"), User("Bar")] | |
user_gen = (u for u in users) | |
> s = SchemaClass(many=True).dump(user_gen) | |
tests/test_schema.py:303: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:436: in dump | |
self._update_fields(many, obj) | |
marshmallow/schema.py:585: in _update_fields | |
ret = self.__filter_fields(field_names, many, obj) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <UserMetaSchema(many=True, strict=False)> | |
field_names = set(['age', 'balance', 'birthdate', 'created', 'email', 'finger_count', ...]) | |
many = False, obj = [<User Foo>, <User Bar>] | |
def __filter_fields(self, field_names, many, obj): | |
"""Return only those field_name:field_obj pairs specified by | |
``field_names``. | |
:param set field_names: Field names to include in the final | |
return dictionary. | |
:returns: An dict of field_name:field_obj pairs. | |
""" | |
# Convert obj to a dict | |
obj_marshallable = utils.to_marshallable_type(obj, | |
field_names=field_names) | |
if obj_marshallable and many: | |
try: # Homogeneous collection | |
obj_prototype = obj_marshallable[0] | |
except IndexError: # Nothing to serialize | |
return self.declared_fields | |
obj_dict = utils.to_marshallable_type(obj_prototype, | |
field_names=field_names) | |
else: | |
obj_dict = obj_marshallable | |
ret = self.dict_class() | |
for key in field_names: | |
if key in self.declared_fields: | |
ret[key] = self.declared_fields[key] | |
else: | |
if obj_dict: | |
try: | |
> attribute_type = type(obj_dict[key]) | |
E TypeError: list index must be an integer, not str | |
marshmallow/schema.py:632: TypeError | |
________________ test_serializing_empty_list_returns_empty_list ________________ | |
def test_serializing_empty_list_returns_empty_list(): | |
> assert UserSchema(many=True).dump([]).data == [] | |
tests/test_schema.py:309: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:445: in dump | |
**kwargs | |
marshmallow/fields.py:187: in serialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:179: in <lambda> | |
getter = lambda d: field_obj.serialize(attr_name, d, accessor=accessor) | |
marshmallow/fields.py:415: in serialize | |
value = self.get_value(attr, obj, accessor=accessor) | |
marshmallow/fields.py:362: in get_value | |
return accessor_func(check_key, obj) | |
marshmallow/utils.py:288: in get_value | |
return _get_value_for_keys(key.split('.'), obj, default) | |
marshmallow/utils.py:293: in _get_value_for_keys | |
return _get_value_for_key(keys[0], obj, default) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
key = 'name', obj = [], default = None | |
def _get_value_for_key(key, obj, default): | |
if isinstance(key, basestring) and hasattr(obj, key): | |
return getattr(obj, key) | |
if is_indexable_but_not_string(obj): | |
try: | |
> return obj[key] | |
E TypeError: list index must be an integer, not str | |
marshmallow/utils.py:304: TypeError | |
__________________________ test_load_errors_with_many __________________________ | |
def test_load_errors_with_many(): | |
class ErrorSchema(Schema): | |
email = fields.Email() | |
data = [ | |
{'email': 'bademail'}, | |
{'email': 'goo@email.com'}, | |
{'email': 'anotherbademail'}, | |
] | |
> data, errors = ErrorSchema(many=True).load(data) | |
tests/test_schema.py:419: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x0000000005541e50> | |
data = [{'email': 'bademail'}, {'email': 'goo@email.com'}, {'email': 'anotherbademail'}] | |
fields_dict = {'email': <fields.Email(default=None, attribute=None, error=None, validate=None, required=False)>} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method ErrorSchema.make_object of <ErrorSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
____________________ TestNestedSchema.test_nested_meta_many ____________________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x0000000004847480> | |
blog = <tests.base.Blog object at 0x0000000004820480> | |
def test_nested_meta_many(self, blog): | |
serialized_blog = BlogUserMetaSchema().dump(blog)[0] | |
assert len(serialized_blog['collaborators']) == 2 | |
expected = [UserMetaSchema().dump(col)[0] for col in blog.collaborators] | |
> assert serialized_blog['collaborators'] == expected | |
E assert [{'age': 123,...20, 58), ...}] == [{'age': 123, ...+00:00', ...}] | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1070: AssertionError | |
____________________ TestNestedSchema.test_nested_load_many ____________________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x0000000003c3a280> | |
def test_nested_load_many(self): | |
in_data = {'title': 'Shine A Light', 'collaborators': [ | |
{'name': 'Mick', 'email': 'mick@stones.com'}, | |
{'name': 'Keith', 'email': 'keith@stones.com'} | |
]} | |
> data, errors = BlogSchema().load(in_data) | |
tests/test_schema.py:1096: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
marshmallow/fields.py:271: in deserialize | |
strict=strict | |
marshmallow/fields.py:104: in _call_and_store | |
value = getter_func(data) | |
marshmallow/fields.py:440: in deserialize | |
return self._call_and_reraise(do_deserialization, UnmarshallingError) | |
marshmallow/fields.py:390: in _call_and_reraise | |
return func() | |
marshmallow/fields.py:437: in do_deserialization | |
output = self._deserialize(value) | |
marshmallow/fields.py:573: in _deserialize | |
data, errors = self.schema.load(value) | |
marshmallow/schema.py:500: in load | |
dict_class=self.dict_class | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <marshmallow.fields.Unmarshaller object at 0x00000000033af328> | |
data = [{'email': 'mick@stones.com', 'name': 'Mick'}, {'email': 'keith@stones.com', 'name': 'Keith'}] | |
fields_dict = {'age': <fields.Float(default=0.0, attribute=None, error=None, validate=None, required=False)>, 'balance': <fields.Pri...ed=False)>, 'created': <fields.DateTime(default=None, attribute=None, error=None, validate=None, required=False)>, ...} | |
many = False, validators = [], preprocess = [] | |
postprocess = [<bound method UserSchema.make_object of <UserSchema(many=True, strict=False)>>] | |
strict = False, dict_class = <type 'dict'> | |
def deserialize(self, data, fields_dict, many=False, validators=None, | |
preprocess=None, postprocess=None, strict=False, dict_class=None): | |
"""Deserialize ``data`` based on the schema defined by ``fields_dict``. | |
:param dict data: The data to deserialize. | |
:param dict fields_dict: Mapping of field names to :class:`Field` objects. | |
:param bool many: Set to `True` if ``data`` should be deserialized as | |
a collection. | |
:param list validators: List of validation functions to apply to the | |
deserialized dictionary. | |
:param list preprocess: List of pre-processing functions. | |
:param list postprocess: List of post-processing functions. | |
:param bool strict: If `True`, raise errors if invalid data are passed in | |
instead of failing silently and storing the errors. | |
:param type dict_class: Dictionary class used to construct the output. | |
:return: A dictionary of the deserialized data. | |
""" | |
dict_class = dict_class or dict | |
# Reset errors if not deserializing a collection | |
if not self.__pending: | |
self.errors = {} | |
if many and data is not None: | |
self.__pending = True | |
ret = [self.deserialize(d, fields_dict, many=False, | |
validators=validators, preprocess=preprocess, | |
postprocess=postprocess, strict=strict, dict_class=dict_class) | |
for d in data] | |
self.__pending = False | |
return ret | |
items = [] | |
for attr_name, field_obj in iteritems(fields_dict): | |
if attr_name not in fields_dict: | |
continue | |
key = fields_dict[attr_name].attribute or attr_name | |
> raw_value = data.get(attr_name, missing) | |
E AttributeError: 'list' object has no attribute 'get' | |
marshmallow/fields.py:261: AttributeError | |
___________ TestNestedSchema.test_serializer_with_nested_meta_fields ___________ | |
self = <tests.test_schema.TestNestedSchema instance at 0x000000000665d680> | |
blog = <tests.base.Blog object at 0x00000000066b1750> | |
def test_serializer_with_nested_meta_fields(self, blog): | |
# Schema has user = fields.Nested(UserMetaSerializer) | |
s = BlogUserMetaSchema().dump(blog) | |
> assert s.data['user'] == UserMetaSchema().dump(blog.user).data | |
E assert {'age': 81, '... 20, 58), ...} == {'age': 81, 'b...8+00:00', ...} | |
E Detailed information truncated, use "-vv" to show | |
tests/test_schema.py:1155: AssertionError | |
==================== 18 failed, 369 passed in 8.42 seconds ===================== | |
ERROR: InvocationError: '/home/svenstaro/prj/marshmallow/.tox/pypy/bin/python setup.py test' | |
___________________________________ summary ____________________________________ | |
SKIPPED: py26: InterpreterNotFound: python2.6 | |
ERROR: py27: commands failed | |
SKIPPED: py33: InterpreterNotFound: python3.3 | |
ERROR: py34: commands failed | |
ERROR: pypy: commands failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment