예제 #1
0
    def test_within_no_end(self):
        """Tests the within method with defined start and no end."""
        t = TimePeriod(start=datetime.datetime(2000, 1, 1))

        # Greater than start
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive start
        self.assertTrue(t.within(datetime.datetime(2000, 1, 1)))

        # Not within below
        self.assertFalse(t.within(datetime.datetime(1999, 1, 1)))

        # Way above
        self.assertTrue(t.within(datetime.datetime(2002, 1, 1)))
예제 #2
0
    def test_within_no_start(self):
        """Tests the within method with defined end and no start."""
        t = TimePeriod(end=datetime.datetime(2001, 1, 1))

        # Less than end
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive end
        self.assertTrue(t.within(datetime.datetime(2001, 1, 1)))

        # Way below
        self.assertTrue(t.within(datetime.datetime(1999, 1, 1)))

        # Not within above
        self.assertFalse(t.within(datetime.datetime(2002, 1, 1)))
예제 #3
0
    def test_within_no_end(self):
        """Tests the within method with defined start and no end."""
        t = TimePeriod(start=datetime.datetime(2000, 1, 1))

        # Greater than start
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive start
        self.assertTrue(t.within(datetime.datetime(2000, 1, 1)))

        # Not within below
        self.assertFalse(t.within(datetime.datetime(1999, 1, 1)))

        # Way above
        self.assertTrue(t.within(datetime.datetime(2002, 1, 1)))
예제 #4
0
    def test_within_no_start(self):
        """Tests the within method with defined end and no start."""
        t = TimePeriod(end=datetime.datetime(2001, 1, 1))

        # Less than end
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive end
        self.assertTrue(t.within(datetime.datetime(2001, 1, 1)))

        # Way below
        self.assertTrue(t.within(datetime.datetime(1999, 1, 1)))

        # Not within above
        self.assertFalse(t.within(datetime.datetime(2002, 1, 1)))
예제 #5
0
    def test_within_standard(self):
        """Tests the within method with defined start and end."""
        t = TimePeriod(start=datetime.datetime(2000, 1, 1),
                       end=datetime.datetime(2001, 1, 1))

        # Clearly within
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive start
        self.assertTrue(t.within(datetime.datetime(2000, 1, 1)))

        # Inclusive end
        self.assertTrue(t.within(datetime.datetime(2001, 1, 1)))

        # Not within below
        self.assertFalse(t.within(datetime.datetime(1999, 1, 1)))

        # Not within above
        self.assertFalse(t.within(datetime.datetime(2002, 1, 1)))
예제 #6
0
    def test_within_standard(self):
        """Tests the within method with defined start and end."""
        t = TimePeriod(start=datetime.datetime(2000, 1, 1),
                       end=datetime.datetime(2001, 1, 1))

        # Clearly within
        self.assertTrue(t.within(datetime.datetime(2000, 6, 1)))

        # Inclusive start
        self.assertTrue(t.within(datetime.datetime(2000, 1, 1)))

        # Inclusive end
        self.assertTrue(t.within(datetime.datetime(2001, 1, 1)))

        # Not within below
        self.assertFalse(t.within(datetime.datetime(1999, 1, 1)))

        # Not within above
        self.assertFalse(t.within(datetime.datetime(2002, 1, 1)))