Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/snl/python/snl_wrapping/PyInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ PyObject* richCompare(T left, T right, int op) {
0, /* tp_setattro */ \
0, /* tp_as_buffer */ \
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ \
"#SELF_TYPE objects", /* tp_doc */ \
#SELF_TYPE" objects", /* tp_doc */ \
0, /* tp_traverse */ \
0, /* tp_clear */ \
0, /* tp_richcompare */ \
Expand Down
10 changes: 10 additions & 0 deletions test/snl/python/pyloader/SNLPrimitivesTest0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,14 @@ TEST_F(SNLPrimitivesTest0, testFaultyPythonScript) {
primitives0Path /= "scripts";
primitives0Path /= "faulty_script.py";
EXPECT_THROW(SNLPyLoader::loadPrimitives(library, primitives0Path), SNLException);
}

TEST_F(SNLPrimitivesTest0, testEmptyPythonScript) {
//faulty python script
auto db = SNLDB::create(SNLUniverse::get());
auto library = SNLLibrary::create(db, SNLLibrary::Type::Primitives, SNLName("PRIMS"));
auto primitives0Path = std::filesystem::path(SNL_PRIMITIVES_TEST_PATH);
primitives0Path /= "scripts";
primitives0Path /= "empty_script.py";
EXPECT_THROW(SNLPyLoader::loadPrimitives(library, primitives0Path), SNLException);
}
3 changes: 3 additions & 0 deletions test/snl/python/pyloader/scripts/empty_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SPDX-FileCopyrightText: 2023 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>
#
# SPDX-License-Identifier: Apache-2.0