def test_present(self): b = None self.assertTrue(present()(5)) self.assertTrue(present()(-5)) self.assertFalse(present()(None)) self.assertFalse(present()(b)) self.assertTrue(present()([]))
def test_invert(self): negative = ~gt(0) positive = ~lt(0) negative2 = ~positive positive2 = ~~~~positive self.assertTrue(negative(-1)) self.assertFalse(negative(1)) self.assertTrue(positive(1)) self.assertFalse(positive(-1)) self.assertTrue(negative2(-1)) self.assertFalse(negative2(1)) self.assertTrue(positive2(1)) self.assertFalse(positive2(-1)) non = ~present() self.assertTrue(non(None)) not_integer = ~oftype(int) self.assertTrue(not_integer(1+1j)) self.assertFalse(not_integer(1))
def test_invert(self): negative = ~gt(0) positive = ~lt(0) negative2 = ~positive positive2 = ~~~~positive self.assertTrue(negative(-1)) self.assertFalse(negative(1)) self.assertTrue(positive(1)) self.assertFalse(positive(-1)) self.assertTrue(negative2(-1)) self.assertFalse(negative2(1)) self.assertTrue(positive2(1)) self.assertFalse(positive2(-1)) non = ~present() self.assertTrue(non(None)) not_integer = ~oftype(int) self.assertTrue(not_integer(1 + 1j)) self.assertFalse(not_integer(1))
def test_present_predicate(self): not_null = present() self.assertTrue(not_null(2)) self.assertTrue(not_null('kebap4e')) self.assertFalse(None)
def test_present_predicate(self): not_null=present() self.assertTrue(not_null(2)) self.assertTrue(not_null('kebap4e')) self.assertFalse(None)
def test_present(self): is_present = present() self.assertTrue(is_present(5)) self.assertFalse(is_present(None))
def test_present(self): self.assertTrue(present()(0)) self.assertFalse(present()(None))