Skip to content

Commit

Permalink
Set datapath once.
Browse files Browse the repository at this point in the history
  • Loading branch information
ways committed Jan 9, 2024
1 parent 48542f8 commit e3e6b51
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/test_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@
from initialize import build_gribfile_name, download_gribfile, API_URL

datafile = ""
data_path = "test_data"


class TestInitialize(unittest.TestCase):
def test_build_gribfile_name(self):
data_path = "test_data"
time = datetime(2023, 1, 1, 6)
expected = os.path.join(data_path, "T_YTNE85_C_ENMI_20230101060000.bin")
actual = build_gribfile_name(data_path, time)
self.assertEqual(expected, actual)

def test_build_gribfile_name2(self):
data_path = "test_data"
expected = os.path.join(data_path, "T_YTNE85_C_ENMI_20230101120000.bin")
actual = build_gribfile_name(data_path, datetime(2023, 1, 1, 13))
self.assertEqual(expected, actual)

def test_download_gribfile(self):
global datafile
datafile = download_gribfile(data_path="/tmp", api_url=API_URL)
datafile = download_gribfile(data_path=data_path, api_url=API_URL)
print(datafile)
self.assertTrue(os.path.isfile(datafile))
os.remove(datafile)
Expand Down

0 comments on commit e3e6b51

Please sign in to comment.