def test_or_raise1(self): self.assertIsNone(EMPTY.or_raise(ValueError()))
def test_get2(self): self.assertIsNone(EMPTY.get())
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)
def test_present(self): self.assertFalse(EMPTY.present()) self.assertTrue(Optional(None).present()) self.assertTrue(Optional(1).present())