def test_data_object(self): inputs = {'args': '1', 'kwargs': {'1': 1, '2': 2}} self.assertRaises(exceptions.DataTypeErrorException, DataObject, None) data_object = DataObject(inputs) self.assertIsInstance(data_object, DataObject) self.assertIsInstance(data_object.inputs, FancyDict) self.assertIsInstance(data_object.outputs, FancyDict) self.assertEqual(data_object.get_inputs(), inputs) self.assertEqual(data_object.get_outputs(), {}) self.assertEqual(data_object.get_one_of_inputs('args'), '1') self.assertEqual(data_object.inputs.args, '1') self.assertIsNone(data_object.get_one_of_outputs('args')) self.assertRaises(exceptions.DataTypeErrorException, data_object.reset_outputs, None) self.assertTrue(data_object.reset_outputs({'a': str})) self.assertEqual(data_object.outputs.a, str) data_object.update_outputs({'args': '1', 'kwargs': {'1': 1, '2': 2}}) self.assertEqual(data_object.get_outputs(), { 'a': str, 'args': '1', 'kwargs': { '1': 1, '2': 2 } }) self.assertEqual( jsonschema.validate(json.loads(data_object.serializer()), BASE_PARAM), None)
def test_data_object(self): inputs = {'args': '1', 'kwargs': {'1': 1, '2': 2}} self.assertRaises(exceptions.DataTypeErrorException, DataObject, None) data_object = DataObject(inputs) self.assertIsInstance(data_object, DataObject) self.assertEqual(data_object.get_inputs(), inputs) self.assertEqual(data_object.get_outputs(), {}) self.assertEqual(data_object.get_one_of_inputs('args'), '1') self.assertIsNone(data_object.get_one_of_outputs('args')) self.assertRaises(exceptions.DataTypeErrorException, data_object.reset_outputs, None) self.assertTrue(data_object.reset_outputs({'a': str}))