Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_wrongtype(self):
try:
attrload(3, Person)
except exceptions.TypedloadTypeError:
pass
data = {
'course': 'how to be a corsair',
'students': [
{'name': 'Alfio'},
3
]
}
try:
attrload(data, Students)
except exceptions.TypedloadTypeError as e:
assert e.trace[-1].annotation[1] == 1
def test_wrongtype(self):
try:
attrload(3, Person)
except exceptions.TypedloadTypeError:
pass
data = {
'course': 'how to be a corsair',
'students': [
{'name': 'Alfio'},
3
]
}
try:
attrload(data, Students)
except exceptions.TypedloadTypeError as e:
assert e.trace[-1].annotation[1] == 1
def test_dict_exception(self):
loader = dataloader.Loader()
with self.assertRaises(exceptions.TypedloadAttributeError):
loader.load(None, Dict[int, int])
def test_list_exception(self):
loader = dataloader.Loader()
with self.assertRaises(exceptions.TypedloadTypeError):
loader.load(None, List[int])