File: test_turkey.py

package info (click to toggle)
python-workalendar 17.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,568 kB
  • sloc: python: 16,500; makefile: 34; sh: 5
file content (87 lines) | stat: -rw-r--r-- 3,366 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from datetime import date

from . import GenericCalendarTest
from ..europe import Turkey


class TurkeyTest(GenericCalendarTest):
    cal_class = Turkey

    def test_year_new_year_shift(self):
        holidays = self.cal.holidays_set(2012)
        self.assertIn(date(2012, 1, 1), holidays)
        self.assertIn(date(2012, 1, 2), holidays)
        holidays = self.cal.holidays_set(2013)
        self.assertIn(date(2013, 1, 1), holidays)
        self.assertNotIn(date(2013, 1, 2), holidays)

    def test_year_2014(self):
        holidays = self.cal.holidays_set(2014)
        # Fixed days section:
        # 1. New years Day
        self.assertIn(date(2014, 1, 1), holidays)
        # 2. National Sovereignty and Children's Day
        self.assertIn(date(2014, 4, 23), holidays)
        # 3. Labor and Solidarity Day
        self.assertIn(date(2014, 5, 1), holidays)
        # 4. Commemoration of Atatürk, Youth and Sports Day
        self.assertIn(date(2014, 5, 19), holidays)
        # 5. Democracy and National Unity Day
        self.assertIn(date(2014, 7, 15), holidays)
        # 6. Victory Day
        self.assertIn(date(2014, 8, 30), holidays)
        # 7. Republic Day
        self.assertIn(date(2014, 10, 29), holidays)

    def test_year_2015(self):
        holidays = self.cal.holidays_set(2015)
        # Fixed days section:
        # 1. New years Day
        self.assertIn(date(2015, 1, 1), holidays)
        # 2. National Sovereignty and Children's Day
        self.assertIn(date(2015, 4, 23), holidays)
        # 3. Labor and Solidarity Day
        self.assertIn(date(2015, 5, 1), holidays)
        # 4. Commemoration of Atatürk, Youth and Sports Day
        self.assertIn(date(2015, 5, 19), holidays)
        # 5. Democracy and National Unity Day
        self.assertIn(date(2015, 7, 15), holidays)
        # 6. Victory Day
        self.assertIn(date(2015, 8, 30), holidays)
        # 7. Republic Day
        self.assertIn(date(2015, 10, 29), holidays)

    def test_year_2019(self):
        holidays = self.cal.holidays_set(2019)
        # Fixed days section:
        # 1. New years Day
        self.assertIn(date(2019, 1, 1), holidays)
        # 2. National Sovereignty and Children's Day
        self.assertIn(date(2019, 4, 23), holidays)
        # 3. Labor and Solidarity Day
        self.assertIn(date(2019, 5, 1), holidays)
        # 4. Commemoration of Atatürk, Youth and Sports Day
        self.assertIn(date(2019, 5, 19), holidays)
        # 5. Democracy and National Unity Day
        self.assertIn(date(2019, 7, 15), holidays)
        # 6. Victory Day
        self.assertIn(date(2019, 8, 30), holidays)
        # 7. Republic Day
        self.assertIn(date(2019, 10, 29), holidays)

        # Religious days
        # Ramadan Feast - 3 days
        self.assertIn(date(2019, 6, 4), holidays)
        self.assertIn(date(2019, 6, 5), holidays)
        self.assertIn(date(2019, 6, 6), holidays)
        # Ramadan Feast - 4 days
        self.assertIn(date(2019, 8, 11), holidays)
        self.assertIn(date(2019, 8, 12), holidays)
        self.assertIn(date(2019, 8, 13), holidays)
        self.assertIn(date(2019, 8, 14), holidays)

    def test_labour_day_label(self):
        holidays = self.cal.holidays(2020)
        holidays = dict(holidays)
        self.assertEqual(
            holidays[date(2020, 5, 1)], "Labor and Solidarity Day")