Skip to content

Commit

Permalink
Fix missing fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentAntoine committed Jul 31, 2024
1 parent 2770ab1 commit 2be4a28
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 48 deletions.
49 changes: 49 additions & 0 deletions datascience/tests/test_pipeline/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import pandas as pd
import pytest


@pytest.fixture
def pno_units_targeting_vessels():
return pd.DataFrame(
{
"vessel_id": [2, 4, 7],
"cfr": ["ABC000542519", None, "___TARGET___"],
"control_unit_ids_targeting_vessel": [[4], [1, 2], [4]],
}
)


@pytest.fixture
def pno_units_ports_and_segments_subscriptions():
return pd.DataFrame(
{
"port_locode": [
"FRCQF",
"FRDKK",
"FRDPE",
"FRLEH",
"FRLEH",
"FRZJZ",
"FRZJZ",
],
"control_unit_id": [1, 2, 4, 2, 3, 2, 3],
"receive_all_pnos_from_port": [
False,
False,
True,
False,
False,
False,
False,
],
"unit_subscribed_segments": [
["SWW01/02/03"],
[],
[],
[],
["SWW01/02/03", "NWW01"],
[],
["SWW01/02/03", "NWW01"],
],
}
)
48 changes: 0 additions & 48 deletions datascience/tests/test_pipeline/test_shared_tasks/test_pnos.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,11 @@
import pandas as pd
import pytest

from src.pipeline.flows.distribute_pnos import extract_pno_units_targeting_vessels
from src.pipeline.shared_tasks.pnos import (
extract_pno_units_ports_and_segments_subscriptions,
)


@pytest.fixture
def pno_units_targeting_vessels():
return pd.DataFrame(
{
"vessel_id": [2, 4, 7],
"cfr": ["ABC000542519", None, "___TARGET___"],
"control_unit_ids_targeting_vessel": [[4], [1, 2], [4]],
}
)


@pytest.fixture
def pno_units_ports_and_segments_subscriptions():
return pd.DataFrame(
{
"port_locode": [
"FRCQF",
"FRDKK",
"FRDPE",
"FRLEH",
"FRLEH",
"FRZJZ",
"FRZJZ",
],
"control_unit_id": [1, 2, 4, 2, 3, 2, 3],
"receive_all_pnos_from_port": [
False,
False,
True,
False,
False,
False,
False,
],
"unit_subscribed_segments": [
["SWW01/02/03"],
[],
[],
[],
["SWW01/02/03", "NWW01"],
[],
["SWW01/02/03", "NWW01"],
],
}
)


def test_extract_pno_units_targeting_vessels(
reset_test_data, pno_units_targeting_vessels
):
Expand Down

0 comments on commit 2be4a28

Please sign in to comment.