Avoid lazy loads in .__repr__()
`ReplaySimulation`, `ReplayedOrder`, and `Forecast` accessed relationships in their `.__repr__()`, which emits queries or fails for detached instances. They now use the foreign key columns.
This commit is contained in:
parent
1f9d0effae
commit
7d53abc057
1 changed files with 8 additions and 7 deletions
|
|
@ -13,5 +13,5 @@ class TestSpecialMethods:
|
|||
result = repr(simulation)
|
||||
|
||||
assert result.startswith("<ReplaySimulation(")
|
||||
assert simulation.city.name in result
|
||||
assert f"city #{simulation.city_id}" in result
|
||||
assert simulation.strategy in result
|
||||
|
|
|
|||
Loading…
Reference in a new issue