Exemple #1
0
 def test_basic(self):
     c = Calendar()
     c = c.add(Day("came 9 left 15 lunch 30m", today))
     c, _ = c.undo()
     c, date_ = c.redo()
     assert "30" in ConsoleDayShower(c).show_days(today, 1)
     assert date_ == today
Exemple #2
0
 def test_only_came(self):
     c = Calendar()
     c = c.add(Day("came 9", today))
     assert "09:00" in ConsoleDayShower(c).show_days(today, 1)
     c, date_ = c.undo()
     assert "09:00" not in ConsoleDayShower(c).show_days(today, 1)
     assert date_ == today
Exemple #3
0
 def test_serialize(self):
     c = Calendar(target_hours_per_day=timedelta(hours=8.00))
     c = c.add(Day("came 9 left 18", today))
     data = c.dump()
     c2 = Calendar.load(data)
     s = ConsoleDayShower(c2).show_days(today, 1)
     assert re.search("Flex *01:00", s)
Exemple #4
0
 def test_time(self):
     c = Calendar()
     c = c.add(Day("came 9 left 15", today))
     data = c.dump()
     c2 = Calendar.load(data)
     assert c2.days[today].came == time(9)
     assert c2.days[today].left == time(15)
Exemple #5
0
 def test_basic(self):
     c = Calendar()
     c = c.add(
         Day(date_=today, project_name="EPG Support", project_time="08:00"))
     c = c.add_project("EPG Support")
     s = ConsoleDayShower(c).show_days(today, 1)
     assert "EPG Support" in s
     assert "08:00" in s
Exemple #6
0
 def test_project(self):
     c = Calendar()
     c = c.add(
         Day(date_=today, project_name="EPG Support", project_time="08:00"))
     c = c.add_project("EPG Support")
     data = c.dump()
     c2 = Calendar.load(data)
     s = ConsoleDayShower(c2).show_days(today, 1)
     assert "EPG Support" in s
     assert "08:00" in s
 def test_added(self):
     c = Calendar()
     wednesday = today + timedelta(days=-today.weekday() + 2)
     c = c.add(Day("came 8 left 18 lunch 45m", wednesday))
     s = ConsoleDayShower(c).show_days(today, 5)
     assert "08:00" in s
     assert "18:00" in s
     assert "0:45" in s
     assert "Came" in s
     assert "Left" in s
     assert "Lunch" in s
Exemple #8
0
 def test_basic(self):
     c = Calendar()
     c = c.add(
         Day(
             args="came 9 left 16:45 lunch 0m",
             date_=today,
             project_name="Parental leave",
             project_time="04:00",
         ))
     c = c.add_project("Parental leave", work=False)
     s = ConsoleDayShower(c).show_days(today, 1)
     assert "Parental leave" in s
     assert "04:00" in s
     assert "07:45" in s
Exemple #9
0
 def test_came_left_lunch(self):
     c = Calendar()
     c = c.add(Day("came 9 left 15 lunch 30m", today))
     assert "30" in ConsoleDayShower(c).show_days(today, 1)
     c, _ = c.undo()
     assert "30" not in ConsoleDayShower(c).show_days(today, 1)
Exemple #10
0
 def test_add_to_nothing(self):
     c = Calendar()
     c = c.add(Day("", today))
     c = c.add(Day("came 8 left 18 lunch 45m", today))
     assert c.days[today] == Day("came 8 left 18 lunch 45m", today)
Exemple #11
0
 def test_change_came_and_left(self):
     c = Calendar()
     c = c.add(Day("came 9 left 16 lunch 45m", today))
     c = c.add(Day("came 8 left 15", today))
     assert c.days[today] == Day("came 8 left 15 lunch 45m", today)
Exemple #12
0
 def test_overwrite_lunch(self):
     c = Calendar()
     c = c.add(Day("lunch 45m", today))
     c = c.add(Day("lunch 35m", today))
     assert c.days[today].lunch == timedelta(minutes=35)
Exemple #13
0
 def test_overwrite_all(self):
     c = Calendar()
     c = c.add(Day("came 9 left 15", today))
     c = c.add(Day("came 8 left 14", today))
     assert c.days[today].came == time(8)
     assert c.days[today].left == time(14)
Exemple #14
0
 def test_add_to_day_inverse_order(self):
     c = Calendar()
     c = c.add(Day("left 15", today))
     c = c.add(Day("came 9", today))
     assert c.days[today].came == time(9)
     assert c.days[today].left == time(15)
Exemple #15
0
 def test_basic(self):
     c = Calendar(target_hours_per_day=timedelta(hours=8.00))
     c = c.add(Day("came 9 left 18", today))
     s = ConsoleDayShower(c).show_days(today, 1)
     assert re.search("Flex *01:00", s)
Exemple #16
0
 def test_add_day(self):
     c = Calendar()
     c = c.add(Day("came 9 left 15", today))
     assert c.days[today].came == time(9)
     assert c.days[today].left == time(15)