Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jgriesfeller committed Dec 1, 2023
1 parent 6f5d772 commit b8264f6
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions tests/test_CSVTimeSeriesReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@


class TestCSVTimeSeriesReader(unittest.TestCase):
file = os.path.join(os.path.dirname(os.path.realpath(__file__)),
'testdata', 'csvReader_testdata.csv')
file = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
"testdata",
"csvReader_testdata.csv",
)

def test_init(self):
engine = pyaro.list_timeseries_engines()['csv_timeseries']
engine = pyaro.list_timeseries_engines()["csv_timeseries"]
self.assertEqual(engine.url(), "https://github.com/metno/pyaro")
# just see that it doesn't fails
engine.description()
Expand All @@ -24,8 +28,8 @@ def test_init(self):
self.assertEqual(len(ts.stations()), 2)

def test_stationfilter(self):
engine = pyaro.list_timeseries_engines()['csv_timeseries']
sfilter = pyaro.timeseries.filters.get('stations', exclude=['station1'])
engine = pyaro.list_timeseries_engines()["csv_timeseries"]
sfilter = pyaro.timeseries.filters.get("stations", exclude=["station1"])
with engine.open(self.file, filters=[sfilter]) as ts:
count = 0
for var in ts.variables():
Expand All @@ -34,20 +38,24 @@ def test_stationfilter(self):
self.assertEqual(len(ts.stations()), 1)

def test_wrappers(self):
engine = pyaro.list_timeseries_engines()['csv_timeseries']
newsox = 'oxidised_sulphur'
with VariableNameChangingReader(engine.open(self.file, filters=[]),
{'SOx': newsox}) as ts:
engine = pyaro.list_timeseries_engines()["csv_timeseries"]
newsox = "oxidised_sulphur"
with VariableNameChangingReader(
engine.open(self.file, filters=[]), {"SOx": newsox}
) as ts:
self.assertEqual(ts.data(newsox).variable, newsox)
pass

def test_variables_filter(self):
engine = pyaro.list_timeseries_engines()['csv_timeseries']
newsox = 'oxidised_sulphur'
vfilter = pyaro.timeseries.filters.get('variables', reader_to_new={'SOx': newsox})
engine = pyaro.list_timeseries_engines()["csv_timeseries"]
newsox = "oxidised_sulphur"
vfilter = pyaro.timeseries.filters.get(
"variables", reader_to_new={"SOx": newsox}
)
with engine.open(self.file, filters=[vfilter]) as ts:
self.assertEqual(ts.data(newsox).variable, newsox)
pass


if __name__ == "__main__":
unittest.main()

0 comments on commit b8264f6

Please sign in to comment.