Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions tests/iotools/test_meteonorm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ def demo_api_key():
# lat=-3, lon=-60 (Brazil)
# lat=51, lon=-114 (Canada)
# lat=24, lon=33 (Egypt)
return 'demo0000-0000-0000-0000-000000000000'
demo_api_key = 'demo0000-0000-0000-0000-000000000000'
return demo_api_key


@pytest.fixture
def demo_url():
return 'https://demo.meteonorm.com/v1/'
demo_url = 'https://demo.meteonorm.com/v1/'
return demo_url
Comment on lines +23 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with the original? For a single URL definition as the whole function, isn't it okay just to leave it as:

Suggested change
demo_url = 'https://demo.meteonorm.com/v1/'
return demo_url
return 'https://demo.meteonorm.com/v1/'

Same for the demo_api_key
Maybe there's something about python (style?) here that I don't know

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just a matter of convenience when I was hacking around locally. With the line split into two, you can run the single-line manually that defines the variable and then run the content of a test function.

Tests are a bit messy to debug sometimes because of all the magic they employ.



@pytest.fixture
Expand Down Expand Up @@ -69,11 +71,11 @@ def expected_meteonorm_data():
[0.0, 0.0],
[0.0, 0.0],
[0.0, 0.0],
[2.5, 2.68309898],
[77.5, 77.47671591],
[165.0, 164.98906908],
[210.75, 210.7458778],
[221.0, 220.99278214],
[2.5, 2.68],
[77.5, 77.47],
[165.0, 164.98],
[210.75, 210.74],
[221.0, 220.99],
]
index = pd.date_range('2023-01-01 00:30', periods=12, freq='1h', tz='UTC')
index.freq = None
Expand Down Expand Up @@ -263,13 +265,13 @@ def expected_meteonorm_tmy_data():
[0.],
[0.],
[0.],
[9.],
[8.4],
[86.6],
[110.5],
[9.06],
[8.43],
[86.63],
[110.44],
]
index = pd.date_range(
'2005-01-01', periods=12, freq='1h', tz=3600)
'2030-01-01', periods=12, freq='1h', tz=3600)
index.freq = None
interval_index = pd.IntervalIndex.from_arrays(
index, index + pd.Timedelta(hours=1), closed='left')
Expand Down
Loading