예제 #1
0
    def test_get_existing_years(self):
        file_names = ["12-2020.json", "01-2021.json", "09-2019.json"]
        for f_name in file_names:
            with open(os.path.join(self.data_directory, f_name), "w") as _:
                pass

        paths = {DATA_FILES_PATH_KEYWORD: self.data_directory}

        data_backend = DataBackend(paths)
        result = data_backend.get_existing_years()
        self.assertEqual([2019, 2020, 2021], result)
예제 #2
0
    def test_get_existing_years_no_years(self):
        paths = {DATA_FILES_PATH_KEYWORD: self.data_directory}

        data_backend = DataBackend(paths)
        result = data_backend.get_existing_years()
        self.assertEqual([], result)