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