Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions test/test_pybind11_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
Expand All @@ -23,6 +22,11 @@ namespace nl = nlohmann;

using namespace pybind11::literals;

inline py::module create_module(const std::string& module_name)
{
return py::module_::create_extension_module(module_name.c_str(), nullptr, new py::module_::module_def);
}

TEST(nljson_serializers_tojson, none)
{
py::scoped_interpreter guard;
Expand Down Expand Up @@ -429,7 +433,7 @@ inline const nl::json& test_fromtojson(const nl::json& json)
TEST(pybind11_caster_tojson, dict)
{
py::scoped_interpreter guard;
py::module m("test");
py::module m = create_module("test");

m.def("to_json", &test_fromtojson);

Expand All @@ -445,7 +449,7 @@ TEST(pybind11_caster_tojson, dict)
TEST(pybind11_caster_fromjson, dict)
{
py::scoped_interpreter guard;
py::module m("test");
py::module m = create_module("test");

m.def("from_json", &test_fromtojson);

Expand Down