def test_applying_with_nothing_in_second_arg(self): self.assertEqual( Maybe.apply(common_tests.add).to_arguments(Just(1), Nothing), Nothing)
def test_exceptions_return_nothing_kleisli_functions(self): self.assertEqual(Maybe.insert(1).then(lambda x: Just(x / 0)), Nothing)
def test_insert(self): self.assertEqual(Maybe.insert(9), Just(9))
def test_exceptions_return_nothing_normal_functions(self): self.assertEqual(Maybe.insert(1).then(lambda x: x / 0), Nothing)
def test_exceptions_do_not_return_nothing_kleisli_functions(self): with self.assertRaises(ZeroDivisionError): Maybe.insert(1).then(lambda x: Just(x / 0)),