Browse Source

fix version info binding

refactoring
Tom Janson 8 years ago
parent
commit
2b9c4b61e7
  1. 8
      src/mod_info.cpp
  2. 6
      tests/info/test_info.py

8
src/mod_info.cpp

@ -4,9 +4,11 @@
PYBIND11_PLUGIN(info) {
py::module m("info", "Storm information");
py::class_<storm::utility::StormVersion>(m, "Version", "Version information for Storm")
.def_property_readonly("short", &storm::utility::StormVersion::shortVersionString, "Storm version in short representation")
.def_property_readonly("long", &storm::utility::StormVersion::longVersionString, "Storm version in long representation")
.def_property_readonly("build_info", &storm::utility::StormVersion::buildInfo, "Build info for Storm")
// static properties are still called with self as argument (which we ignore), see
// https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties
.def_property_readonly_static("short", [](py::object /* self */){ return storm::utility::StormVersion::shortVersionString(); }, "Storm version in short representation")
.def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation")
.def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm")
;
return m.ptr();
}

6
tests/info/test_info.py

@ -4,6 +4,6 @@ from stormpy.info import info
class TestInfo:
def test_version(self):
s = info.Version.short
s = info.Version.long
s = info.Version.build_info
assert isinstance(info.Version.short, str) and "." in info.Version.short
assert isinstance(info.Version.long, str) and "Version" in info.Version.long
assert isinstance(info.Version.build_info, str) and "Compiled" in info.Version.build_info
Loading…
Cancel
Save