File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
tests/unit/test_parameters Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 11import numpy as np
22import pytest
33
4+ import pybamm
5+
46
57@pytest .fixture
68def assert_is_ndarray ():
@@ -14,3 +16,8 @@ def _assert(obj):
1416 assert isinstance (obj , np .ndarray )
1517
1618 return _assert
19+
20+
21+ @pytest .fixture
22+ def simple_param ():
23+ return pybamm .ParameterValues ({"a" : 1 })
Original file line number Diff line number Diff line change @@ -41,19 +41,18 @@ def test_init(self):
4141 with pytest .raises (ValueError , match = "'Junk' is not a valid parameter set." ):
4242 pybamm .ParameterValues ("Junk" )
4343
44- def test_repr (self ):
45- param = pybamm .ParameterValues ({"a" : 1 })
46- assert "'a': 1" in repr (param )
47- assert param ._ipython_key_completions_ () == [
44+ def test_repr (self , simple_param ):
45+ assert "'a': 1" in repr (simple_param )
46+ assert simple_param ._ipython_key_completions_ () == [
4847 "Ideal gas constant [J.K-1.mol-1]" ,
4948 "Faraday constant [C.mol-1]" ,
5049 "Boltzmann constant [J.K-1]" ,
5150 "Electron charge [C]" ,
5251 "a" ,
5352 ]
5453
55- def test_eq (self ):
56- assert pybamm . ParameterValues ({ "a" : 1 }) == pybamm .ParameterValues ({"a" : 1 })
54+ def test_eq (self , simple_param ):
55+ assert simple_param == pybamm .ParameterValues ({"a" : 1 })
5756
5857 def test_update (self ):
5958 # equate values
You can’t perform that action at this time.
0 commit comments