Exemplo n.º 1
0
 def test_dumps_default_many(self):
     d_int = DataClassIntImmutableDefault()
     assert d_int.x == 0
     assert DataClassIntImmutableDefault.schema().dumps([d_int], many=True) == '[{"x": 0}]'
     d_bool = DataClassBoolImmutableDefault()
     assert d_bool.x is False
     assert DataClassBoolImmutableDefault.schema().dumps([d_bool], many=True) == '[{"x": false}]'
Exemplo n.º 2
0
 def test_dumps_default(self):
     d_int = DataClassIntImmutableDefault()
     assert d_int.x == 0
     assert DataClassIntImmutableDefault.schema().dumps(d_int) == '{"x": 0}'
     d_bool = DataClassBoolImmutableDefault()
     assert d_bool.x is False
     assert DataClassBoolImmutableDefault.schema().dumps(d_bool) == '{"x": false}'
Exemplo n.º 3
0
 def test_loads_default_many(self):
     assert (DataClassIntImmutableDefault.schema().loads(
         '[{}]', many=True) == [DataClassIntImmutableDefault()])
     assert (DataClassBoolImmutableDefault.schema().loads(
         '[{}]', many=True) == [DataClassBoolImmutableDefault()])
Exemplo n.º 4
0
 def test_loads_default(self):
     assert (DataClassIntImmutableDefault.schema().loads('{}') ==
             DataClassIntImmutableDefault())
     assert (DataClassBoolImmutableDefault.schema().loads('{}') ==
             DataClassBoolImmutableDefault())