|
20 | 20 | from muse.__main__ import patched_broadcast_compat_data |
21 | 21 | from muse.agents import Agent |
22 | 22 | from muse.commodities import CommodityUsage |
23 | | -from muse.timeslices import TIMESLICE, setup_module |
| 23 | +from muse.timeslices import TIMESLICE, read_timeslices, setup_module |
24 | 24 |
|
25 | 25 | # Constants |
26 | 26 | RANDOM_SEED = 123 |
@@ -192,11 +192,15 @@ def compare_dirs( |
192 | 192 | def default_timeslice_globals(): |
193 | 193 | """Set up default timeslice configuration.""" |
194 | 194 | setup_module(DEFAULT_TIMESLICES) |
| 195 | + return DEFAULT_TIMESLICES |
195 | 196 |
|
196 | 197 |
|
197 | 198 | @fixture |
198 | | -def timeslice(default_timeslice_globals) -> Dataset: |
| 199 | +def timeslice(default_timeslice_globals) -> DataArray: |
199 | 200 | """Get the default timeslice dataset.""" |
| 201 | + if TIMESLICE is None: |
| 202 | + # If TIMESLICE is not set, create it from the default timeslices |
| 203 | + return read_timeslices(default_timeslice_globals) |
200 | 204 | return TIMESLICE |
201 | 205 |
|
202 | 206 |
|
@@ -387,7 +391,7 @@ def technologies(coords: Mapping) -> Dataset: |
387 | 391 |
|
388 | 392 |
|
389 | 393 | @fixture |
390 | | -def agent_market(coords: Mapping, timeslice: Dataset) -> Dataset: |
| 394 | +def agent_market(coords: Mapping, timeslice: DataArray) -> Dataset: |
391 | 395 | """Generate market data for agent testing. |
392 | 396 |
|
393 | 397 | Args: |
@@ -419,7 +423,7 @@ def agent_market(coords: Mapping, timeslice: Dataset) -> Dataset: |
419 | 423 |
|
420 | 424 |
|
421 | 425 | @fixture |
422 | | -def market(coords: Mapping, timeslice: Dataset) -> Dataset: |
| 426 | +def market(coords: Mapping, timeslice: DataArray) -> Dataset: |
423 | 427 | """Generate market data for testing. |
424 | 428 |
|
425 | 429 | Args: |
@@ -578,7 +582,7 @@ def _stock(coords: Mapping, technologies: Dataset) -> Dataset: |
578 | 582 |
|
579 | 583 |
|
580 | 584 | @fixture |
581 | | -def demand_share(coords: Mapping, timeslice: Dataset) -> DataArray: |
| 585 | +def demand_share(coords: Mapping, timeslice: DataArray) -> DataArray: |
582 | 586 | """Generate demand share data for testing. |
583 | 587 |
|
584 | 588 | Args: |
|
0 commit comments