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
|
|
@ -52,7 +52,7 @@ class TestSpecialMethods:
|
|||
|
||||
assert (
|
||||
result
|
||||
== f"<Forecast: {forecast.prediction} for pixel ({forecast.pixel.n_x}|{forecast.pixel.n_y}) at {forecast.start_at}>" # noqa:E501
|
||||
== f"<Forecast: {forecast.prediction} for pixel #{forecast.pixel_id} at {forecast.start_at}>" # noqa:E501
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue