Beispiel #1
0
def test_deserialize_update_existing_type():
    existing = ComplicatedType(string_type="foo", int_type=321, boolean_type=False, embedded_type=EmbeddedType(embedded_id=simple_id, embedded_string="one"))
    update = {"boolean_type": True, "embedded_type": {"embedded_string": "two"}, "int_type": None}
    assert_not_equal(existing.boolean_type, update["boolean_type"])
    assert_not_equal(existing.int_type, update["int_type"])
    assert_not_equal(existing.embedded_type.embedded_string, update["embedded_type"]["embedded_string"])
    plain_to_document(update, existing)
    assert_equal(existing.boolean_type, update["boolean_type"])
    assert_equal(existing.int_type, update["int_type"])
    assert_equal(existing.embedded_type.embedded_string, update["embedded_type"]["embedded_string"])
    assert_equal(existing.embedded_type.embedded_id, simple_id)
Beispiel #2
0
def check_proper_deserialization(to_deserialize, type, expected_result):
    assert_equal(plain_to_document(to_deserialize, type), expected_result)