示例#1
0
def test_list_of_lists():
    x = [[1, 2], ["hello", "wookies"], [A(1), A(2)]]
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#2
0
def test_dict_of_lists():
    x = {"a": [1, 2, 3], "b": ["hello", "goodbye"], "1": [A(1), A(2)]}
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#3
0
def test_tuple_to_serializable():
    x = (1, 2.0, "wolves")
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#4
0
def test_float():
    eq_(1.4, from_serializable_repr(to_serializable_repr(1.4)))
def test_str():
    eq_("waffles", from_serializable_repr(to_serializable_repr("waffles")))
def test_float():
    eq_(1.4, from_serializable_repr(to_serializable_repr(1.4)))
示例#7
0
def test_serialize_builtin_class():
    int_reconstructed = from_serializable_repr(to_serializable_repr(int))
    eq_(int, int_reconstructed)
示例#8
0
def test_object_with_set_values():
    x = B()
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#9
0
def test_serialize_builtin_class():
    int_reconstructed = from_serializable_repr(to_serializable_repr(int))
    eq_(int, int_reconstructed)
示例#10
0
def test_serialize_custom_class():
    A_reconstructed = from_serializable_repr(to_serializable_repr(A))
    eq_(A, A_reconstructed)
示例#11
0
def test_namedtuple_to_json():
    eq_(instance, from_serializable_repr(to_serializable_repr(instance)))
示例#12
0
def test_serialize_custom_function():
    fn_reconstructed = from_serializable_repr(to_serializable_repr(global_fn))
    eq_(global_fn, fn_reconstructed)
示例#13
0
def test_serialize_builtin_function():
    fn_reconstructed = from_serializable_repr(to_serializable_repr(sum))
    eq_(sum, fn_reconstructed)
示例#14
0
def test_dict_with_tuple_keys():
    x = {(1, 2): "hello"}
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#15
0
def test_serialize_custom_class():
    A_reconstructed = from_serializable_repr(to_serializable_repr(A))
    eq_(A, A_reconstructed)
示例#16
0
def test_object_with_dict_values():
    x = A(dict(snooze=5))
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
示例#17
0
def test_bool():
    eq_(False, from_serializable_repr(to_serializable_repr(False)))
def test_bool():
    eq_(False, from_serializable_repr(to_serializable_repr(False)))
示例#19
0
def test_str():
    eq_("waffles", from_serializable_repr(to_serializable_repr("waffles")))
def test_int():
    eq_(1, from_serializable_repr(to_serializable_repr(1)))
示例#21
0
def test_int():
    eq_(1, from_serializable_repr(to_serializable_repr(1)))
示例#22
0
def test_serialize_object_with_helpers():
    instance_reconstructed = from_serializable_repr(
        to_serializable_repr(instance))
    eq_(instance, instance_reconstructed)
示例#23
0
def test_serialize_object_with_helpers():
    instance_reconstructed = from_serializable_repr(
        to_serializable_repr(instance))
    eq_(instance, instance_reconstructed)