How to use the typedload.exceptions function in typedload

To help you get started, we’ve selected a few typedload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ltworf / typedload / tests / test_attrload.py View on Github external
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
github ltworf / typedload / tests / test_attrload.py View on Github external
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
github ltworf / typedload / tests / test_dataloader.py View on Github external
def test_dict_exception(self):
        loader = dataloader.Loader()
        with self.assertRaises(exceptions.TypedloadAttributeError):
            loader.load(None, Dict[int, int])
github ltworf / typedload / tests / test_dataloader.py View on Github external
def test_list_exception(self):
        loader = dataloader.Loader()
        with self.assertRaises(exceptions.TypedloadTypeError):
            loader.load(None, List[int])