Browse Source

more cosmetics

refactoring
Tom Janson 8 years ago
parent
commit
64701f79d0
  1. 2
      setup.py
  2. 18
      tests/storage/test_bitvector.py
  3. 11
      tests/storage/test_model_instantiator.py

2
setup.py

@ -92,7 +92,7 @@ setup(
CMakeExtension('storage', subdir='storage'), CMakeExtension('storage', subdir='storage'),
CMakeExtension('utility', subdir='utility') CMakeExtension('utility', subdir='utility')
], ],
cmdclass=dict(build_ext=CMakeBuild, test=PyTest),
cmdclass={'build_ext': CMakeBuild, 'test': PyTest},
zip_safe=False, zip_safe=False,
tests_require=['pytest'], tests_require=['pytest'],
) )

18
tests/storage/test_bitvector.py

@ -19,24 +19,24 @@ class TestBitvector:
bit = stormpy.BitVector(5, [2, 3]) bit = stormpy.BitVector(5, [2, 3])
assert bit.size() == 5 assert bit.size() == 5
assert bit.number_of_set_bits() == 2 assert bit.number_of_set_bits() == 2
assert bit.get(0) == False
assert bit.get(1) == False
assert bit.get(2) == True
assert bit.get(3) == True
assert bit.get(4) == False
assert bit.get(0) is False
assert bit.get(1) is False
assert bit.get(2) is True
assert bit.get(3) is True
assert bit.get(4) is False
def test_init_bitvector(self): def test_init_bitvector(self):
bit = stormpy.BitVector(7, [0, 6]) bit = stormpy.BitVector(7, [0, 6])
bit2 = stormpy.BitVector(bit) bit2 = stormpy.BitVector(bit)
assert bit == bit2 assert bit == bit2
assert bit2.get(0) == True
assert bit2.get(6) == True
assert bit2.get(0) is True
assert bit2.get(6) is True
def test_negate(self): def test_negate(self):
bit = stormpy.BitVector(7, [0, 6]) bit = stormpy.BitVector(7, [0, 6])
bit2 = stormpy.BitVector(bit) bit2 = stormpy.BitVector(bit)
bit = ~bit bit = ~bit
assert bit.get(0) == False
assert bit.get(6) == False
assert bit.get(0) is False
assert bit.get(6) is False
for i in range(bit.size()): for i in range(bit.size()):
assert bit.get(i) is not bit2.get(i) assert bit.get(i) is not bit2.get(i)

11
tests/storage/test_model_instantiator.py

@ -11,12 +11,11 @@ class TestModel:
model = stormpy.build_parametric_model(program, formulas) model = stormpy.build_parametric_model(program, formulas)
parameters = model.collect_probability_parameters() parameters = model.collect_probability_parameters()
instantiator = stormpy.ModelInstantiator(model) instantiator = stormpy.ModelInstantiator(model)
point = dict()
for p in parameters:
point[p] = 0.4
point = {p: 0.4 for p in parameters}
instantiated_model = instantiator.instantiate(point) instantiated_model = instantiator.instantiate(point)
assert instantiated_model.nr_states == model.nr_states assert instantiated_model.nr_states == model.nr_states
assert not instantiated_model.has_parameters assert not instantiated_model.has_parameters
for p in parameters:
point[p] = 0.5
instatiated_model2 = instantiator.instantiate(point)
point = {p: 0.5 for p in parameters}
instantiated_model2 = instantiator.instantiate(point)
Loading…
Cancel
Save