示例#1
0
 def test_or_raise1(self):
     self.assertIsNone(EMPTY.or_raise(ValueError()))
示例#2
0
 def test_get2(self):
     self.assertIsNone(EMPTY.get())
示例#3
0
 def test_or_else(self):
     self.assertEqual(EMPTY.or_else(1), 1)
     self.assertIsNone(Optional(None).or_else(10))
     self.assertEqual(Optional(10).or_else(1), 10)
示例#4
0
 def test_present(self):
     self.assertFalse(EMPTY.present())
     self.assertTrue(Optional(None).present())
     self.assertTrue(Optional(1).present())