entso-e tests dont work with API token anymore
Summary
The tests use a mock response for normal testing, but a personal API Token can be defined to do Rest API requests. However 3/11 Tests fail by doing so.
Explain your context
Define entso-e Token
Was there an error message?
eta_utility\connectors\entso_e.py:230: in read_series
return pd.concat(results, axis=1, sort=False)
C:\Users\panca\AppData\Local\pypoetry\Cache\virtualenvs\eta-utility-kajRwwF4-py3.10\lib\site-packages\pandas\core\reshape\concat.py:382: in concat
op = _Concatenator(
C:\Users\panca\AppData\Local\pypoetry\Cache\virtualenvs\eta-utility-kajRwwF4-py3.10\lib\site-packages\pandas\core\reshape\concat.py:445: in __init__
objs, keys = self._clean_keys_and_objs(objs, keys)
C:\Users\panca\AppData\Local\pypoetry\Cache\virtualenvs\eta-utility-kajRwwF4-py3.10\lib\site-packages\pandas\core\reshape\concat.py:504: in _clean_keys_and_objs
objs_list = list(objs)
C:\Users\panca\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py:621: in result_iterator
yield _result_or_cancel(fs.pop())
C:\Users\panca\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py:319: in _result_or_cancel
return fut.result(timeout)
C:\Users\panca\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py:451: in result
return self.__get_result()
C:\Users\panca\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\_base.py:403: in __get_result
raise self._exception
C:\Users\panca\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py:58: in run
result = self.fn(*self.args, **self.kwargs)
eta_utility\connectors\entso_e.py:209: in read_node
data = self._handle_xml(result.content)
eta_utility\connectors\entso_e.py:165: in _handle_xml
s = pd.Series(data=ts_data, index=datetime_range, name=col_name)
C:\Users\panca\AppData\Local\pypoetry\Cache\virtualenvs\eta-utility-kajRwwF4-py3.10\lib\site-packages\pandas\core\series.py:575: in __init__
com.require_length_match(data, index)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
data = ['94.68', '93.97', '99.45', '106.67', '103.6', '110.4', ...]
index = DatetimeIndex(['2022-02-15 23:00:00', '2022-02-16 00:00:00',
'2022-02-16 01:00:00', '2022-02-16 02:00:0...:00',
'2022-02-16 21:00:00', '2022-02-16 22:00:00'],
dtype='datetime64[ns]', freq='60min')
def require_length_match(data, index: Index) -> None:
"""
Check the length of data matches the length of the index.
"""
if len(data) != len(index):
> raise ValueError(
"Length of values "
f"({len(data)}) "
"does not match length of index "
f"({len(index)})"
)
E ValueError: Length of values (23) does not match length of index (24)
C:\Users\panca\AppData\Local\pypoetry\Cache\virtualenvs\eta-utility-kajRwwF4-py3.10\lib\site-packages\pandas\core\common.py:573: ValueError