Skip to content

Commit

Permalink
add test that should be fixed when fixing this bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rmudambi committed Dec 10, 2024
1 parent aaa271f commit 32b011f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/framework/components/test_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tests.helpers import (
AllColumnsRequirer,
ColumnCreator,
ColumnCreatorAndAllRequirer,
ColumnCreatorAndRequirer,
ColumnRequirer,
CustomPriorities,
Expand Down Expand Up @@ -104,6 +105,19 @@ def test_component_that_creates_and_requires_columns_population_view():
assert set(component.population_view.columns) == set(expected_columns)


@pytest.mark.xfail(reason="This is due to a bug to be fixed by MIC-5373")
def test_component_that_creates_column_and_requires_all_columns_population_view():
component = ColumnCreatorAndAllRequirer()
simulation = InteractiveContext(components=[ColumnCreator(), component])
population = simulation.get_population()

# Assert population view is set and has the correct columns
expected_columns = population.columns

assert component.population_view is not None
assert set(component.population_view.columns) == set(expected_columns)


def test_component_with_initialization_requirements():
simulation = InteractiveContext(
components=[ColumnCreator(), ColumnCreatorAndRequirer()],
Expand Down
6 changes: 6 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ def on_initialize_simulants(self, pop_data: SimulantData) -> None:
self.population_view.update(initialization_data)


class ColumnCreatorAndAllRequirer(ColumnCreatorAndRequirer):
@property
def columns_required(self) -> list[str]:
return []


class AllColumnsRequirer(Component):
@property
def columns_required(self) -> list[str]:
Expand Down

0 comments on commit 32b011f

Please sign in to comment.