def setUp(self):
     self.simple_model = create_simple_model_with_json_representation()[0]
     self.simple_model_as_json = create_simple_model_with_json_representation(
     )[1]
     self.complex_model = create_complex_model_with_json_representation()[0]
     self.complex_model_as_json = create_complex_model_with_json_representation(
     )[1]
 def test_default_with_iterable(self):
     simple_models = [
         create_simple_model_with_json_representation(i)[0]
         for i in range(10)
     ]
     simple_models_as_json = [
         create_simple_model_with_json_representation(i)[1]
         for i in range(10)
     ]
     encoded = SimpleModelMappingJSONEncoder().default(simple_models)
     self.assertCountEqual(encoded, simple_models_as_json)
 def test_decode_with_iterable(self):
     simple_models = [
         create_simple_model_with_json_representation(i)[0]
         for i in range(10)
     ]
     simple_models_as_json = [
         create_simple_model_with_json_representation(i)[1]
         for i in range(10)
     ]
     json_as_string = json.dumps(simple_models_as_json)
     decoded = SimpleModelMappingJSONDecoder().decode(json_as_string)
     self.assertCountEqual(decoded, simple_models)
Esempio n. 4
0
 def setUp(self):
     self.simple_model = create_simple_model_with_json_representation()[0]
     self.simple_model_as_json = create_simple_model_with_json_representation()[1]
Esempio n. 5
0
 def setUp(self):
     self.values = set([create_simple_model_with_json_representation(i)[0] for i in range(10)])
     self.values_as_json = [create_simple_model_with_json_representation(i)[1] for i in range(10)]
     self.ValueJSONDecoder = MappingJSONDecoderClassBuilder(
         SimpleModel, get_simple_model_json_property_mappings()).build()
Esempio n. 6
0
 def test_default_with_iterable(self):
     simple_models = [create_simple_model_with_json_representation(i)[0] for i in range(10)]
     simple_models_as_json = [create_simple_model_with_json_representation(i)[1] for i in range(10)]
     encoded = SimpleModelMappingJSONEncoder().default(simple_models)
     self.assertCountEqual(encoded, simple_models_as_json)
Esempio n. 7
0
 def test_decode_with_iterable(self):
     simple_models = [create_simple_model_with_json_representation(i)[0] for i in range(10)]
     simple_models_as_json = [create_simple_model_with_json_representation(i)[1] for i in range(10)]
     json_as_string = json.dumps(simple_models_as_json)
     decoded = SimpleModelMappingJSONDecoder().decode(json_as_string)
     self.assertCountEqual(decoded, simple_models)