def test_invalid_input_not_list(self): input_str = '{"People": "foo"}' field = AnonymousListField( "People", EmbeddedDictField(ScalarField("Name"), ScalarField("Age")) ) input_data = json.loads(input_str) with self.assertRaises(ListFieldValueNotAListException): field.parse(data=input_data, context={"parent_alti_key": "test_parent"})
def test_invalid_input_missing_source_key(self): input_str = '{"People": [{"Name": "Bob", "Age": 49}, {"Name": "Sue", "Age": 42}]}' field = AnonymousListField( "Stuff", EmbeddedDictField(ScalarField("Name"), ScalarField("Age")) ) input_data = json.loads(input_str) with self.assertRaises(ListFieldSourceKeyNotFoundException): field.parse(data=input_data, context={"parent_alti_key": "test_parent"})