diff --git a/examples/01-getting-started.py b/examples/01-getting-started.py index d24c888..69caec5 100644 --- a/examples/01-getting-started.py +++ b/examples/01-getting-started.py @@ -13,5 +13,5 @@ def example_getting_started_01(): print("Number of transitions: {}".format(model.nr_transitions)) print("Labels: {}".format(model.labeling.get_labels())) -if __name__ == 'main': +if __name__ == '__main__': example_getting_started_01() \ No newline at end of file diff --git a/examples/02-getting-started.py b/examples/02-getting-started.py index 6306f11..ff4a9bf 100644 --- a/examples/02-getting-started.py +++ b/examples/02-getting-started.py @@ -29,5 +29,5 @@ def example_getting_started_02(): print("Number of transitions: {}".format(model_for_formula_2.nr_transitions)) print("Labels in the model: {}".format(model_for_formula_2.labeling.get_labels())) -if __name__ == 'main': +if __name__ == '__main__': example_getting_started_02() \ No newline at end of file diff --git a/examples/03-getting-started.py b/examples/03-getting-started.py index c406fc4..665040d 100644 --- a/examples/03-getting-started.py +++ b/examples/03-getting-started.py @@ -17,6 +17,8 @@ def example_getting_started_03(): assert result.result_for_all_states for x in result.get_values(): print(x) + initial_state = model.initial_states[0] + print(result.at(initial_state)) -if __name__ == 'main': +if __name__ == '__main__': example_getting_started_03() \ No newline at end of file diff --git a/examples/04-getting-started.py b/examples/04-getting-started.py index 037015d..173ed8a 100644 --- a/examples/04-getting-started.py +++ b/examples/04-getting-started.py @@ -17,15 +17,17 @@ def example_getting_started_04(): properties = stormpy.parse_properties_for_prism_program(formula_str, prism_program) model = stormpy.build_parametric_model(prism_program, properties) print("Model supports parameters: {}".format(model.supports_parameters)) + parameters = model.collect_probability_parameters() + assert len(parameters) == 2 instantiator = stormpy.pars.PDtmcInstantiator(model) point = dict() - parameters = model.collect_probability_parameters() for x in parameters: print(x.name) point[x] = stormpy.RationalRF(0.4) instantiated_model = instantiator.instantiate(point) result = stormpy.model_checking(instantiated_model, properties[0]) + print(result) -if __name__ == 'main': +if __name__ == '__main__': example_getting_started_04() \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..b227aef --- /dev/null +++ b/setup.cfg @@ -0,0 +1,8 @@ +[aliases] +test=pytest + +[tool:pytest] +addopts = --doctest-glob='*.rst' +testpaths = tests/ examples/ +python_files = test*.py examples/*.py +python_functions = *_test test_* example_* \ No newline at end of file diff --git a/setup.py b/setup.py index 9e0f447..a3c62df 100755 --- a/setup.py +++ b/setup.py @@ -196,5 +196,6 @@ setup( cmdclass={'build_ext': CMakeBuild, 'test': PyTest}, zip_safe=False, install_requires=['pycarl>=2.0.0'], + setup_requires=['pytest-runner'], tests_require=['pytest'], )