Beispiel #1
0
    def test_compare_after_range(self):
        """compare to a time after the range."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        after = self._strp("2010-12-15 12:00")

        self.assertFalse(range1.contains(after))
Beispiel #2
0
    def test_compare_before_time(self):
        """compare to a time before the range."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        before = self._strp("2010-01-15 12:00")

        self.assertFalse(range1.contains(before))
Beispiel #3
0
    def test_compare_during_range(self):
        """compare to a time during the time."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        during = self._strp("2010-07-15 12:00")

        self.assertTrue(range1.contains(during))
Beispiel #4
0
    def test_compare_after_range(self):
        """compare to a time after the range."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        after = self._strp("2010-12-15 12:00")

        self.assertFalse(range1.contains(after))
Beispiel #5
0
    def test_compare_during_range(self):
        """compare to a time during the time."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        during = self._strp("2010-07-15 12:00")

        self.assertTrue(range1.contains(during))
Beispiel #6
0
    def test_compare_before_time(self):
        """compare to a time before the range."""
        taa = self._strp("2010-06-01 12:00")
        tbb = self._strp("2010-08-01 12:00")
        range1 = TimeRange(taa, tbb)

        before = self._strp("2010-01-15 12:00")

        self.assertFalse(range1.contains(before))
Beispiel #7
0
    def test_containment_to_overlap(self):
        """compare for containment to an overlapping range."""
        taa = self._strp("2010-01-01 12:00")
        tbb = self._strp("2010-09-01 12:00")
        range1 = TimeRange(taa, tbb)

        tcc = self._strp("2010-06-01 12:00")
        tdd = self._strp("2010-12-01 12:00")
        range2 = TimeRange(tcc, tdd)

        self.assertFalse(range1.contains(range2))
Beispiel #8
0
    def test_contain_complete_contain(self):
        """compare for containment to a completely contained range."""
        taa = self._strp("2010-01-01 12:00")
        tbb = self._strp("2010-09-01 12:00")
        range1 = TimeRange(taa, tbb)

        tcc = self._strp("2010-03-01 12:00")
        tdd = self._strp("2010-06-01 12:00")
        range2 = TimeRange(tcc, tdd)

        self.assertTrue(range1.contains(range2))
Beispiel #9
0
    def test_containment_to_overlap(self):
        """compare for containment to an overlapping range."""
        taa = self._strp("2010-01-01 12:00")
        tbb = self._strp("2010-09-01 12:00")
        range1 = TimeRange(taa, tbb)

        tcc = self._strp("2010-06-01 12:00")
        tdd = self._strp("2010-12-01 12:00")
        range2 = TimeRange(tcc, tdd)

        self.assertFalse(range1.contains(range2))
Beispiel #10
0
    def test_contain_complete_contain(self):
        """compare for containment to a completely contained range."""
        taa = self._strp("2010-01-01 12:00")
        tbb = self._strp("2010-09-01 12:00")
        range1 = TimeRange(taa, tbb)

        tcc = self._strp("2010-03-01 12:00")
        tdd = self._strp("2010-06-01 12:00")
        range2 = TimeRange(tcc, tdd)

        self.assertTrue(range1.contains(range2))