`ReplaySimulation`, `ReplayedOrder`, and `Forecast` accessed relationships in their `.__repr__()`, which emits queries or fails for detached instances. They now use the foreign key columns.
17 lines
602 B
Python
17 lines
602 B
Python
"""Test the ORM's `ReplaySimulation` model."""
|
|
|
|
|
|
class TestSpecialMethods:
|
|
"""Test special methods in `ReplaySimulation`."""
|
|
|
|
def test_create_simulation(self, simulation):
|
|
"""Test instantiation of a new `ReplaySimulation` object."""
|
|
assert simulation is not None
|
|
|
|
def test_text_representation(self, simulation):
|
|
"""`ReplaySimulation` has a non-literal text representation."""
|
|
result = repr(simulation)
|
|
|
|
assert result.startswith("<ReplaySimulation(")
|
|
assert f"city #{simulation.city_id}" in result
|
|
assert simulation.strategy in result
|