Skip to content

Commit c0acf46

Browse files
committed
Minor manual changes
1 parent d62c897 commit c0acf46

1 file changed

Lines changed: 6 additions & 16 deletions

File tree

tests/conftest.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,10 @@
2020
from muse.__main__ import patched_broadcast_compat_data
2121
from muse.agents import Agent
2222
from muse.commodities import CommodityUsage
23-
from muse.timeslices import TIMESLICE, read_timeslices, setup_module
23+
from muse.timeslices import setup_module
2424

2525
# Constants
2626
RANDOM_SEED = 123
27-
DEFAULT_FACTOR = 100.0
28-
DEFAULT_TECH_TYPES = ["solid", "liquid", "solid", "liquid"]
29-
DEFAULT_FUELS = ["person", "person", "oil", "person"]
3027

3128
DEFAULT_TIMESLICES = """
3229
[timeslices]
@@ -74,7 +71,6 @@ def logger():
7471

7572
@fixture(autouse=True)
7673
def patch_broadcast_compat_data():
77-
"""Patch broadcast compatibility data."""
7874
with patch(
7975
"xarray.core.variable._broadcast_compat_data", patched_broadcast_compat_data
8076
):
@@ -192,15 +188,13 @@ def compare_dirs(
192188
def default_timeslice_globals():
193189
"""Set up default timeslice configuration."""
194190
setup_module(DEFAULT_TIMESLICES)
195-
return DEFAULT_TIMESLICES
196191

197192

198193
@fixture
199194
def timeslice(default_timeslice_globals) -> DataArray:
200195
"""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)
196+
from muse.timeslices import TIMESLICE
197+
204198
return TIMESLICE
205199

206200

@@ -259,9 +253,7 @@ def agent_args(coords: Mapping) -> Mapping:
259253
}
260254

261255

262-
def var_generator(
263-
result: Dataset, dims: list[str], factor: float = DEFAULT_FACTOR
264-
) -> tuple:
256+
def var_generator(result: Dataset, dims: list[str], factor: float = 100.0) -> tuple:
265257
"""Generate random variables for a dataset.
266258
267259
Args:
@@ -289,8 +281,8 @@ def technologies(coords: Mapping) -> Dataset:
289281
result = Dataset(coords=coords)
290282

291283
result["comm_type"] = ("commodity", coords["comm_type"])
292-
result["tech_type"] = "technology", DEFAULT_TECH_TYPES
293-
result["fuel"] = "technology", DEFAULT_FUELS
284+
result["tech_type"] = "technology", ["solid", "liquid", "solid", "liquid"]
285+
result["fuel"] = "technology", ["person", "person", "oil", "person"]
294286

295287
result = result.set_coords(("comm_type", "fuel", "tech_type"))
296288

@@ -782,6 +774,4 @@ def rng(request):
782774
Returns:
783775
Random number generator instance
784776
"""
785-
from numpy.random import default_rng
786-
787777
return default_rng(getattr(request.config.option, "randomly_seed", None))

0 commit comments

Comments
 (0)