Exemplo n.º 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)))
Exemplo n.º 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)))
Exemplo n.º 3
0
def test_tuple_to_serializable():
    x = (1, 2.0, "wolves")
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
Exemplo n.º 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)))
Exemplo n.º 7
0
def test_serialize_builtin_class():
    int_reconstructed = from_serializable_repr(to_serializable_repr(int))
    eq_(int, int_reconstructed)
Exemplo n.º 8
0
def test_object_with_set_values():
    x = B()
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
Exemplo n.º 9
0
def test_serialize_builtin_class():
    int_reconstructed = from_serializable_repr(to_serializable_repr(int))
    eq_(int, int_reconstructed)
Exemplo n.º 10
0
def test_serialize_custom_class():
    A_reconstructed = from_serializable_repr(to_serializable_repr(A))
    eq_(A, A_reconstructed)
Exemplo n.º 11
0
def test_namedtuple_to_json():
    eq_(instance, from_serializable_repr(to_serializable_repr(instance)))
Exemplo n.º 12
0
def test_serialize_custom_function():
    fn_reconstructed = from_serializable_repr(to_serializable_repr(global_fn))
    eq_(global_fn, fn_reconstructed)
Exemplo n.º 13
0
def test_serialize_builtin_function():
    fn_reconstructed = from_serializable_repr(to_serializable_repr(sum))
    eq_(sum, fn_reconstructed)
Exemplo n.º 14
0
def test_dict_with_tuple_keys():
    x = {(1, 2): "hello"}
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
Exemplo n.º 15
0
def test_serialize_custom_class():
    A_reconstructed = from_serializable_repr(to_serializable_repr(A))
    eq_(A, A_reconstructed)
Exemplo n.º 16
0
def test_object_with_dict_values():
    x = A(dict(snooze=5))
    eq_(x, from_serializable_repr(to_serializable_repr(x)))
Exemplo n.º 17
0
def test_bool():
    eq_(False, from_serializable_repr(to_serializable_repr(False)))
Exemplo n.º 18
0
def test_bool():
    eq_(False, from_serializable_repr(to_serializable_repr(False)))
Exemplo n.º 19
0
def test_str():
    eq_("waffles", from_serializable_repr(to_serializable_repr("waffles")))
Exemplo n.º 20
0
def test_int():
    eq_(1, from_serializable_repr(to_serializable_repr(1)))
Exemplo n.º 21
0
def test_int():
    eq_(1, from_serializable_repr(to_serializable_repr(1)))
Exemplo n.º 22
0
def test_serialize_object_with_helpers():
    instance_reconstructed = from_serializable_repr(
        to_serializable_repr(instance))
    eq_(instance, instance_reconstructed)
Exemplo n.º 23
0
def test_serialize_object_with_helpers():
    instance_reconstructed = from_serializable_repr(
        to_serializable_repr(instance))
    eq_(instance, instance_reconstructed)