Skip to content

Commit

Permalink
test: README changes on master
Browse files Browse the repository at this point in the history
  • Loading branch information
fleimgruber committed Aug 8, 2022
1 parent 782e1cd commit 47c3372
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 14 deletions.
20 changes: 15 additions & 5 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ def country_code_to():
BASIC_QUERIES_SERIES = [
"query_day_ahead_prices",
"query_net_position",
"query_load",
"query_load_forecast",
"query_aggregate_water_reservoirs_and_hydro_storage",
]

BASIC_QUERIES_DATAFRAME = [
"query_load",
"query_load_forecast",
"query_wind_and_solar_forecast",
"query_generation_forecast",
"query_generation",
Expand Down Expand Up @@ -100,6 +101,15 @@ def test_crossborder_queries(
result = getattr(client, query)(country_code_from, country_code_to, start=start, end=end)
assert not result.empty


def test_query_offered_capacity(client, country_code_from, country_code_to, start, end):
contract_marketagreement_type = "A01"
result = client.query_offered_capacity(
country_code_from, country_code_to, start, end, contract_marketagreement_type, implicit=True
)
assert not result.empty


# pandas.DataFrames

@pytest.mark.parametrize(
Expand All @@ -114,15 +124,15 @@ def test_basic_queries_dataframe(client, query, country_code, start, end):
def test_query_contracted_reserve_prices(client, country_code, start, end):
type_marketagreement_type = "A01"
result = client.query_contracted_reserve_prices(
country_code, start=start, end=end, type_marketagreement_type=type_marketagreement_type
country_code, start=start, end=end, type_marketagreement_type=type_marketagreement_type, psr_type=None
)
assert not result.empty


def test_query_contracted_reserve_amount(client, country_code, start, end):
type_marketagreement_type = "A01"
result = client.query_contracted_reserve_amount(
country_code, start=start, end=end, type_marketagreement_type=type_marketagreement_type
country_code, start=start, end=end, type_marketagreement_type=type_marketagreement_type, psr_type=None
)
assert not result.empty

Expand All @@ -145,6 +155,6 @@ def test_query_procured_balancing_capacity_process_type_not_allowed(client, coun
def test_query_procured_balancing_capacity(client, country_code, start, end):
process_type = "A47"
result = client.query_procured_balancing_capacity(
country_code, start=start, end=end, process_type=process_type
country_code, start=start, end=end, process_type=process_type, type_marketagreement_type=None
)
assert not result.empty
34 changes: 25 additions & 9 deletions tests/test_raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def country_code_to():
"query_generation_per_plant",
"query_installed_generation_capacity",
"query_installed_generation_capacity_per_unit",
"query_aggregate_water_reservoirs_and_hydro_storage",
]

CROSSBORDER_QUERIES = [
Expand All @@ -77,7 +78,6 @@ def country_code_to():
"query_net_transfer_capacity_weekahead",
"query_net_transfer_capacity_monthahead",
"query_net_transfer_capacity_yearahead",
"query_intraday_offered_capacity",
]

# XML
Expand All @@ -104,10 +104,27 @@ def test_crossborder_queries(
assert valid_xml(result)


def test_query_intraday_offered_capacity(client, country_code_from, country_code_to, start, end):
result = client.query_intraday_offered_capacity(
country_code_from, country_code_to, start, end, implicit=True
)
assert isinstance(result, str)
assert valid_xml(result)


def test_query_offered_capacity(client, country_code_from, country_code_to, start, end):
contract_marketagreement_type = "A01"
result = client.query_offered_capacity(
country_code_from, country_code_to, start, end, contract_marketagreement_type, implicit=True
)
assert isinstance(result, str)
assert valid_xml(result)


def test_query_contracted_reserve_prices(client, country_code, start, end):
type_marketagreement_type = "A01"
result = client.query_contracted_reserve_prices(
country_code, start, end, type_marketagreement_type
country_code, start, end, type_marketagreement_type, psr_type=None
)
assert isinstance(result, str)
assert valid_xml(result)
Expand All @@ -116,17 +133,16 @@ def test_query_contracted_reserve_prices(client, country_code, start, end):
def test_query_contracted_reserve_amount(client, country_code, start, end):
type_marketagreement_type = "A01"
result = client.query_contracted_reserve_amount(
country_code, start, end, type_marketagreement_type
country_code, start, end, type_marketagreement_type, psr_type=None
)
assert isinstance(result, str)
assert valid_xml(result)


def test_query_procured_balancing_capacity_bytearray(client, country_code, start, end):
type_marketagreement_type = "A01"
process_type = "A47"
result = client.query_procured_balancing_capacity(
country_code, start, end, process_type, type_marketagreement_type
country_code, start, end, process_type, type_marketagreement_type=None
)
assert isinstance(result, str)
assert valid_xml(result)
Expand All @@ -143,25 +159,25 @@ def test_query_procured_balancing_capacity_process_type_not_allowed(client):
# ZIP

def test_query_imbalance_prices(client, country_code, start, end):
result = client.query_imbalance_prices(country_code, start, end)
result = client.query_imbalance_prices(country_code, start, end, psr_type=None)
assert isinstance(result, (bytes, bytearray))


def test_query_unavailability_of_generation_units(client, country_code, start, end):
result = client.query_unavailability_of_generation_units(country_code, start, end,)
result = client.query_unavailability_of_generation_units(country_code, start, end, docstatus=None, periodstartupdate=None, periodendupdate=None)
assert isinstance(result, (bytes, bytearray))


def test_query_unavailability_of_production_units(client, country_code, start, end):
result = client.query_unavailability_of_production_units(country_code, start, end,)
result = client.query_unavailability_of_production_units(country_code, start, end, docstatus=None, periodstartupdate=None, periodendupdate=None)
assert isinstance(result, (bytes, bytearray))


def test_query_unavailability_transmission(
client, country_code_from, country_code_to, start, end
):
result = client.query_unavailability_transmission(
country_code_from, country_code_to, start, end,
country_code_from, country_code_to, start, end, docstatus=None, periodstartupdate=None, periodendupdate=None
)
assert isinstance(result, (bytes, bytearray))

Expand Down

0 comments on commit 47c3372

Please sign in to comment.