def setUp(self) -> None: self.interval = ClosedInterval(2, 9) self.date_interval = ClosedInterval(datetime.date(2019, 2, 7), datetime.date(2019, 2, 14)) self.datetime_interval = ClosedInterval( datetime.datetime(2019, 2, 7, 11, 30), datetime.datetime(2019, 2, 7, 12, 30))
def test_Interval_gt_exception(self): with self.assertRaises(TypeError): k = HalfClosedIntervalLeft(2, 9) j = ClosedInterval(2, 9) k > j
def test_ge(self): self.assertTrue(self.interval >= ClosedInterval(2, 9)) self.assertTrue(self.interval >= ClosedInterval(1, 9)) self.assertFalse(self.interval >= ClosedInterval(3, 9))
def test_gt(self): self.assertTrue(self.interval > ClosedInterval(2, 7)) self.assertTrue(self.interval > ClosedInterval(1, 10)) self.assertFalse(self.interval > ClosedInterval(2, 9))
def test_lt(self): self.assertTrue(self.interval < ClosedInterval(2, 10)) self.assertTrue(self.interval < ClosedInterval(3, 10)) self.assertFalse(self.interval < ClosedInterval(2, 9))
def test_ne(self): self.assertTrue(self.interval != ClosedInterval(2, 8)) self.assertFalse(self.interval != ClosedInterval(2, 9))