test_state2.py: added test_tables.

This commit is contained in:
Steinar Foss
2019-09-13 14:32:58 +02:00
parent 0ae8c4b235
commit 78ab86e2a3
4 changed files with 26 additions and 31 deletions

View File

@@ -5,13 +5,12 @@
namespace {
double evaluate( const TableManager& tab,
std::string tab_name,
int tab_idx,
std::string col_name, double x ) try {
return tab[tab_name].getTable(tab_idx).evaluate(col_name, x);
} catch( std::invalid_argument& e ) {
throw py::key_error( e.what() );
double eval( const TableManager& tab, std::string tab_name, int tab_idx, std::string col_name, double x ) {
try {
return tab[tab_name].getTable(tab_idx).evaluate(col_name, x);
} catch( std::invalid_argument& e ) {
throw py::key_error( e.what() );
}
}
}
@@ -20,6 +19,6 @@ void python::common::export_TableManager(py::module& module) {
py::class_< TableManager >( module, "Tables")
.def( "__contains__", &TableManager::hasTables )
.def("_evaluate", &evaluate );
.def("evaluate", &eval);
}