From 2b9c4b61e7a497dedb9220a5e5c5ece8c1bd6d99 Mon Sep 17 00:00:00 2001 From: Tom Janson Date: Mon, 13 Mar 2017 10:45:24 +0100 Subject: [PATCH] fix version info binding --- src/mod_info.cpp | 8 +++++--- tests/info/test_info.py | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/mod_info.cpp b/src/mod_info.cpp index 77ed769..471f528 100644 --- a/src/mod_info.cpp +++ b/src/mod_info.cpp @@ -4,9 +4,11 @@ PYBIND11_PLUGIN(info) { py::module m("info", "Storm information"); py::class_(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(); } diff --git a/tests/info/test_info.py b/tests/info/test_info.py index 176e4fd..1545fb0 100644 --- a/tests/info/test_info.py +++ b/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