How to use the runtype.InputTypeError function in runtype

To help you get started, we’ve selected a few runtype 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 madisonmay / Runtype / tests / test_typed.py View on Github external
def test_typed_fn(self):
        # ensure no error is raised and function behaves as intended
        assert add_ints(1, 2) == 3

        # ensure invalid types cause TypeErrors to be raised
        with self.assertRaises(InputTypeError):
            add_ints(1.0, 2.0)
github madisonmay / Runtype / tests / test_typed.py View on Github external
def test_list_type(self):
        assert sum_list([1, 2]) == 3

        with self.assertRaises(InputTypeError):
            sum_list([1.0, 2.0])