コード例 #1
0
ファイル: test_maybe.py プロジェクト: wboxx1/boxx-pymonad
 def test_applying_with_nothing_in_second_arg(self):
     self.assertEqual(
         Maybe.apply(common_tests.add).to_arguments(Just(1), Nothing),
         Nothing)
コード例 #2
0
ファイル: test_maybe.py プロジェクト: wboxx1/boxx-pymonad
 def test_exceptions_return_nothing_kleisli_functions(self):
     self.assertEqual(Maybe.insert(1).then(lambda x: Just(x / 0)), Nothing)
コード例 #3
0
ファイル: test_maybe.py プロジェクト: wboxx1/boxx-pymonad
 def test_insert(self):
     self.assertEqual(Maybe.insert(9), Just(9))
コード例 #4
0
ファイル: test_maybe.py プロジェクト: wboxx1/boxx-pymonad
 def test_exceptions_return_nothing_normal_functions(self):
     self.assertEqual(Maybe.insert(1).then(lambda x: x / 0), Nothing)
コード例 #5
0
ファイル: test_maybe.py プロジェクト: openbrian/pymonad
 def test_exceptions_do_not_return_nothing_kleisli_functions(self):
     with self.assertRaises(ZeroDivisionError):
         Maybe.insert(1).then(lambda x: Just(x / 0)),