Expose C++ objects to Python runtime

This commit is contained in:
Joakim Hove
2019-09-12 16:34:37 +02:00
parent 40570f1aba
commit 69ddffc966
8 changed files with 84 additions and 13 deletions

View File

@@ -26,6 +26,8 @@
#include <boost/test/unit_test.hpp>
#include <opm/parser/eclipse/Python/Python.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#ifndef EMBEDDED_PYTHON
@@ -41,6 +43,14 @@ BOOST_AUTO_TEST_CASE(INSTANTIATE) {
Opm::Python python;
BOOST_CHECK(python);
BOOST_CHECK_NO_THROW(python.exec("print('Hello world')"));
Opm::Parser parser;
Opm::Deck deck;
std::string python_code = R"(
print('Parser: {}'.format(context.parser))
print('Deck: {}'.format(context.deck))
)";
BOOST_CHECK_NO_THROW( python.exec(python_code, parser, deck));
}
#endif