How to use the runtype.ReturnTypeError 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_return_type_coercion(self):
        assert coerce_to_int_and_return(1.0, 2.0) == 3

        with self.assertRaises(ReturnTypeError):
            coerce_to_int_and_return("one", "two")
github madisonmay / Runtype / tests / test_typed.py View on Github external
def test_return_type(self):
        assert returns_int(1, 2) == 3

        with self.assertRaises(ReturnTypeError):
            returns_int(1.0, 2.0)