Exemplo n.º 1
0
 def setUp(self):
     self.A = activities('A',
                       datetime.now(),
                       datetime.now() + timedelta(minutes = 7))
     self.B = activities('B',
                       datetime.now() - timedelta(hours = 1),
                       datetime.now() + timedelta(hours = 1))
     self.C = activities('C',
                       datetime.now() + timedelta(minutes = 10),
                       datetime.now() + timedelta(hours = 1))
Exemplo n.º 2
0
 def test_equality(self):
     self.assertEqual(self.A, self.A)
     self.assertNotEqual(self.A, activities('B',
                       datetime(year = 2008, month = 7, day = 15),
                       datetime(year = 2009, month = 5, day = 2)))
     self.assertNotEqual(self.A, activities('A',
                       datetime(year = 2007, month = 7, day = 15),
                       datetime(year = 2009, month = 5, day = 2)))
     self.assertNotEqual(self.A, activities('A',
                       datetime(year = 2008, month = 7, day = 15),
                       datetime(year = 2010, month = 5, day = 2)))
Exemplo n.º 3
0
 def test_equality(self):
     self.assertEqual(self.A, self.A)
     self.assertNotEqual(
         self.A,
         activities('B', datetime(year=2008, month=7, day=15),
                    datetime(year=2009, month=5, day=2)))
     self.assertNotEqual(
         self.A,
         activities('A', datetime(year=2007, month=7, day=15),
                    datetime(year=2009, month=5, day=2)))
     self.assertNotEqual(
         self.A,
         activities('A', datetime(year=2008, month=7, day=15),
                    datetime(year=2010, month=5, day=2)))
Exemplo n.º 4
0
    def test_overlap_inner(self):
        activity = activities('activity name',
                          datetime(year = 2007, month = 10, day = 11),
                          datetime(year = 2010, month = 1, day = 27))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 5
0
    def test_overlap_outer(self):
        activity = activities('activity name',
                          datetime(year = 2008, month = 8, day = 12),
                          datetime(year = 2008, month = 9, day = 15))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 6
0
    def test_overlap_outer(self):
        activity = activities('activity name',
                              datetime(year=2008, month=8, day=12),
                              datetime(year=2008, month=9, day=15))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 7
0
    def test_overlap_inner(self):
        activity = activities('activity name',
                              datetime(year=2007, month=10, day=11),
                              datetime(year=2010, month=1, day=27))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 8
0
    def test_overlap_end(self):
        activity = activities('activity name',
                          datetime(year = 2008, month = 1, day = 11),
                          datetime(year = 2010, month = 4, day = 16))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 9
0
    def test_overlap_end(self):
        activity = activities('activity name',
                              datetime(year=2008, month=1, day=11),
                              datetime(year=2010, month=4, day=16))

        self.assertTrue(activity.overlaps(self.A))
        self.assertTrue(activity.excludes(self.A))
Exemplo n.º 10
0
    def test_repr(self):
        activity = activities('activity name',
                              datetime(year=2007, month=9, day=11),
                              datetime(year=2008, month=4, day=27))

        expected = "<activity name 2007-09-11T00:00:00 2008-04-27T00:00:00>"

        self.assertEqual(repr(activity), expected)
Exemplo n.º 11
0
    def test_repr(self):
        activity = activities('activity name',
                              datetime(year = 2007, month = 9, day = 11),
                              datetime(year = 2008, month = 4, day = 27))

        expected = "<activity name 2007-09-11T00:00:00 2008-04-27T00:00:00>"

        self.assertEqual(repr(activity), expected)
Exemplo n.º 12
0
    def test_valid(self):
        activity = activities('activity name',
                              datetime(year=2007, month=9, day=11),
                              datetime(year=2008, month=4, day=27))

        self.assertEqual(activity.name, 'activity name')
        self.assertEqual(activity.begins, datetime(year=2007, month=9, day=11))
        self.assertEqual(activity.ends, datetime(year=2008, month=4, day=27))
Exemplo n.º 13
0
    def test_excludes(self):
        activity = activities('activity name',
                              datetime(year=2007, month=9, day=11),
                              datetime(year=2007, month=10, day=6))

        # Any activity should exclude any other activity
        self.assertTrue(activity.excludes(activity))

        # Anything not known to be excluded should be included
        self.assertFalse(activity.excludes(None))
Exemplo n.º 14
0
    def test_valid(self):
        activity = activities('activity name',
                              datetime(year = 2007, month = 9, day = 11),
                              datetime(year = 2008, month = 4, day = 27))

        self.assertEqual(activity.name, 'activity name')
        self.assertEqual(activity.begins,
                         datetime(year = 2007, month = 9, day = 11))
        self.assertEqual(activity.ends,
                         datetime(year = 2008, month = 4, day = 27))
Exemplo n.º 15
0
    def test_excludes(self):
        activity = activities('activity name',
                              datetime(year = 2007, month = 9, day = 11),
                              datetime(year = 2007, month = 10, day = 6))

        # Any activity should exclude any other activity
        self.assertTrue(activity.excludes(activity))

        # Anything not known to be excluded should be included
        self.assertFalse(activity.excludes(None))
Exemplo n.º 16
0
    def setUp(self):
        self.A = statuses('A', datetime.now(),
                          datetime.now() + timedelta(minutes=7))
        self.B = statuses('B',
                          datetime.now() - timedelta(hours=1),
                          datetime.now() + timedelta(hours=1))
        self.C = statuses('C',
                          datetime.now() + timedelta(minutes=10),
                          datetime.now() + timedelta(hours=1))

        self.D = activities('D', datetime.now(),
                            datetime.now() + timedelta(minutes=7))

        self.E = activities('E',
                            datetime.now() + timedelta(minutes=30),
                            datetime.now() + timedelta(hours=1))

        self.F = activities('F',
                            datetime.now() - timedelta(minutes=20),
                            datetime.now() + timedelta(minutes=40))
Exemplo n.º 17
0
    def setUp(self):
        self.A = statuses('A',
                          datetime.now(),
                          datetime.now() + timedelta(minutes = 7))
        self.B = statuses('B',
                          datetime.now() - timedelta(hours = 1),
                          datetime.now() + timedelta(hours = 1))
        self.C = statuses('C',
                          datetime.now() + timedelta(minutes = 10),
                          datetime.now() + timedelta(hours = 1))

        self.D = activities('D',
                            datetime.now(),
                            datetime.now() + timedelta(minutes = 7))

        self.E = activities('E',
                            datetime.now() + timedelta(minutes = 30),
                            datetime.now() + timedelta(hours = 1))

        self.F = activities('F',
                            datetime.now() - timedelta(minutes = 20),
                            datetime.now() + timedelta(minutes = 40))
Exemplo n.º 18
0
 def setUp(self):
     self.A = activities('A',
                       datetime(year = 2008, month = 7, day = 15),
                       datetime(year = 2009, month = 5, day = 2))
Exemplo n.º 19
0
    def test_overlap_begin(self):
        activity = activities('activity name',
                              datetime(year=2007, month=8, day=11),
                              datetime(year=2007, month=11, day=27))

        self.assertTrue(activity.overlaps(self.other))
Exemplo n.º 20
0
    def test_overlap_after(self):
        activity = activities('activity name',
                              datetime(year = 2008, month = 2, day = 6),
                              datetime(year = 2008, month = 4, day = 27))

        self.assertFalse(activity.overlaps(self.other))
Exemplo n.º 21
0
    def test_overlap_before(self):
        activity = activities('activity name',
                              datetime(year=2007, month=9, day=11),
                              datetime(year=2007, month=10, day=6))

        self.assertFalse(activity.overlaps(self.other))
Exemplo n.º 22
0
    def test_overlap_before(self):
        activity = activities('activity name',
                              datetime(year = 2007, month = 9, day = 11),
                              datetime(year = 2007, month = 10, day = 6))

        self.assertFalse(activity.overlaps(self.other))
Exemplo n.º 23
0
    def test_overlap_begin(self):
        activity = activities('activity name',
                              datetime(year = 2007, month = 8, day = 11),
                              datetime(year = 2007, month = 11, day = 27))

        self.assertTrue(activity.overlaps(self.other))
Exemplo n.º 24
0
    def test_overlap_after(self):
        activity = activities('activity name',
                              datetime(year=2008, month=2, day=6),
                              datetime(year=2008, month=4, day=27))

        self.assertFalse(activity.overlaps(self.other))
Exemplo n.º 25
0
 def setUp(self):
     self.A = activities('A', datetime(year=2008, month=7, day=15),
                         datetime(year=2009, month=5, day=2))