Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #599 +/- ##
=======================================
Coverage 99.81% 99.81%
=======================================
Files 5 5
Lines 1600 1619 +19
=======================================
+ Hits 1597 1616 +19
Misses 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Does this need to convert into generations first? I reckon it does the wrong thing when Will effectively produce times in graph3 multiplied by |
|
Doesn't this also do the wrong thing when I think in this case it would be better to just |
777e5c3 to
5f3db35
Compare
|
I think I got both of your questions answered. Unfortunately, the current tests were invariant to the current vs the previous implementation, implying that they are poor tests. I'll add a double-convert test like you mentioned... |
|
The test still looks very fragile to me. There's nothing here checking that the times or the units have actually changed. For instance, one can just delete most of the code in change_time_units() and the tests still pass. diff --git a/demes/demes.py b/demes/demes.py
index d965a7d..1db085a 100644
--- a/demes/demes.py
+++ b/demes/demes.py
@@ -2017,19 +2017,6 @@ class Graph:
raise ValueError(f"generation time must be 1, got {generation_time}")
return graph
- for deme in graph.demes:
- deme.start_time *= generation_time
- for epoch in deme.epochs:
- epoch.start_time *= generation_time
- epoch.end_time *= generation_time
- for migration in graph.migrations:
- migration.start_time *= generation_time
- migration.end_time *= generation_time
- for pulse in graph.pulses:
- pulse.time *= generation_time
- graph.time_units = time_units
- graph.generation_time = generation_time
-
return graph
def rename_demes(self, names: Mapping[str, str]) -> Graph: |
Can you point me to relevant tests that you were using in the implementation over in stdpopsim? |
|
The mypy failure is wrong and cannot be reproduced locally with either of the following: uv sync -p 3.14 --all-groups uv sync -p 3.12 --all-groups |
02c0d35 to
d7eb0ea
Compare
There probably weren't any tests there. If I recall correctly, the code there was not intended to be merged, it was just there as part of a conversion of models to demes YAML, and the final converted models were to be merged (eventually). The code was in the in-dev PR to help document the semi-automated conversion process. The PR was incomplete and never got merged. If you're ok with it, I can add a commit or two with additional tests. It won't be today though. |
Sure -- I'm okay with that. I did add a locally scoped function to ensure that the values do indeed change. |
Closes #574