Esempio n. 1
0
    def test_parse_archive_multiple_months(self):
        file_parser = Parser()

        archive_string = "2014-11\n3. 8:00 1:00 17:05"
        for n in (4, 5, 6, 7,
                  10, 11, 12, 13, 14,
                  17, 18, 19, 20, 21,
                  24, 25, 26, 27, 28):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        archive_string += "\n\n2014-12\n1. 8:00 1:00 17:05"
        for n in (2, 3, 4, 5,
                  8, 9, 10, 11, 12,
                  15, 16, 17, 18, 19,
                  22, 23, 24, 25, 26,
                  29, 30, 31):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        archive_string += "\n\n2015-01\n1. 8:00 1:00 17:05"
        for n in (2,
                  5, 6, 7, 8, 9,
                  12, 13, 14, 15, 16,
                  19, 20, 21, 22, 23,
                  26, 27, 28, 29, 30):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        file_name = save_archive_file(archive_string, self.temp_dir.name)
        archive_1 = file_parser.parse_archive_file(file_name)
        nt.assert_true(len(archive_1.months), 3)
        nt.assert_true(archive_1.calculate_flextime,
                       datetime.timedelta(minutes=15))

        nt.assert_true(archive_1.next_month, "2015-02")
Esempio n. 2
0
    def test_parse_archive_multiple_months(self):
        file_parser = Parser()

        archive_string = "2014-11\n3. 8:00 1:00 17:05"
        for n in (4, 5, 6, 7, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 24, 25,
                  26, 27, 28):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        archive_string += "\n\n2014-12\n1. 8:00 1:00 17:05"
        for n in (2, 3, 4, 5, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24,
                  25, 26, 29, 30, 31):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        archive_string += "\n\n2015-01\n1. 8:00 1:00 17:05"
        for n in (2, 5, 6, 7, 8, 9, 12, 13, 14, 15, 16, 19, 20, 21, 22, 23, 26,
                  27, 28, 29, 30):
            archive_string += "\n{}. 8:00 1:00 17:00".format(n)

        file_name = save_archive_file(archive_string, self.temp_dir.name)
        archive_1 = file_parser.parse_archive_file(file_name)
        nt.assert_true(len(archive_1.months), 3)
        nt.assert_true(archive_1.calculate_flextime,
                       datetime.timedelta(minutes=15))

        nt.assert_true(archive_1.next_month, "2015-02")
Esempio n. 3
0
    def test_parse_archive_one_month(self):
        file_parser = Parser()
        month_string = "2014-09\n1. 8:00 1:00 17:05"
        for n in (2, 3, 4, 5, 8, 9, 10, 11, 12, 15, 16, 17, 18, 19, 22, 23, 24,
                  25, 26, 29, 30):
            month_string += "\n{}. 8:00 1:00 17:00".format(n)
        file_name = save_archive_file(month_string, self.temp_dir.name)
        archive_1 = file_parser.parse_archive_file(file_name)
        nt.assert_true(len(archive_1.months), 1)
        nt.assert_true(archive_1.months[0].year, 2014)
        nt.assert_true(archive_1.months[0].month, 9)
        nt.assert_true(archive_1.calculate_flextime,
                       datetime.timedelta(minutes=5))

        nt.assert_true(archive_1.next_month, "2014-10")
Esempio n. 4
0
    def test_parse_archive_one_month(self):
        file_parser = Parser()
        month_string = "2014-09\n1. 8:00 1:00 17:05"
        for n in (2, 3, 4, 5,
                  8, 9, 10, 11, 12,
                  15, 16, 17, 18, 19,
                  22, 23, 24, 25, 26,
                  29, 30):
            month_string += "\n{}. 8:00 1:00 17:00".format(n)
        file_name = save_archive_file(month_string, self.temp_dir.name)
        archive_1 = file_parser.parse_archive_file(file_name)
        nt.assert_true(len(archive_1.months), 1)
        nt.assert_true(archive_1.months[0].year, 2014)
        nt.assert_true(archive_1.months[0].month, 9)
        nt.assert_true(archive_1.calculate_flextime,
                       datetime.timedelta(minutes=5))

        nt.assert_true(archive_1.next_month, "2014-10")