Skip to content

Commit

Permalink
fix: typos when using Cpp::Evaluate (#124)
Browse files Browse the repository at this point in the history
* fix: typos when using `Cpp::Evaluate`

* update tests tags
  • Loading branch information
Vipul-Cariappa authored Jan 23, 2025
1 parent f18794a commit 2b9656e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion python/cppyy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def sizeof(tt):
try:
sz = ctypes.sizeof(tt)
except TypeError:
sz = gbl.Cpp.Evaluate("sizeof(%s);" % (_get_name(tt),))
sz = gbl.Cpp.Evaluate("sizeof(%s)" % (_get_name(tt),))
_sizes[tt] = sz
return sz

Expand Down
5 changes: 3 additions & 2 deletions test/test_cpp11features.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def test09_lambda_calls(self):
assert cppyy.gbl.gMyLambda(2) == 42
assert cppyy.gbl.gMyLambda(40) == 80

if cppyy.gbl.Cpp.Evaluate("__cplusplus;") >= 201402:
if cppyy.gbl.Cpp.Evaluate("__cplusplus") >= 201402:
cppyy.cppdef("auto gime_a_lambda1() { return []() { return 42; }; }")
l1 = cppyy.gbl.gime_a_lambda1()
assert l1
Expand All @@ -336,12 +336,13 @@ def test09_lambda_calls(self):
assert l3
assert l3(2) == 48

@mark.xfail
def test10_optional(self):
"""Use of optional and nullopt"""

import cppyy

if 201703 <= cppyy.gbl.Cpp.Evaluate("__cplusplus;"):
if 201703 <= cppyy.gbl.Cpp.Evaluate("__cplusplus"):
assert cppyy.gbl.std.optional
assert cppyy.gbl.std.nullopt

Expand Down
8 changes: 4 additions & 4 deletions test/test_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def setup_class(cls):
import cppyy
cls.datatypes = cppyy.load_reflection_info(cls.test_dct)
cls.N = 5 #cppyy.gbl.N
at_least_17 = 201402 < cppyy.gbl.Cpp.Evaluate("__cplusplus;")
at_least_17 = 201402 < cppyy.gbl.Cpp.Evaluate("__cplusplus")
cls.has_byte = at_least_17
cls.has_optional = at_least_17

Expand Down Expand Up @@ -193,7 +193,7 @@ def test01_instance_data_read_access(self):

c.__destruct__()

@mark.xfail(condition=not IS_CLANG_REPL, reason="fails with Cling")
@mark.xfail
def test02_instance_data_write_access(self):
"""Test write access to instance public data and verify values"""

Expand Down Expand Up @@ -378,7 +378,7 @@ def test03_array_passing(self):

c.__destruct__()

@mark.xfail(condition= not(IS_CLANG_REPL), reason="Fails on with Cling")
@mark.xfail
def test04_class_read_access(self):
"""Test read access to class public data and verify values"""

Expand Down Expand Up @@ -442,7 +442,7 @@ def test04_class_read_access(self):

c.__destruct__()

@mark.xfail(condition = not(IS_CLANG_REPL), reason="Fails on Cling")
@mark.xfail
def test05_class_data_write_access(self):
"""Test write access to class public data and verify values"""

Expand Down
2 changes: 1 addition & 1 deletion test/test_fragile.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def test01_abortive_signals(self):
class TestSTDNOTINGLOBAL:
def setup_class(cls):
import cppyy
cls.has_byte = 201402 < cppyy.gbl.Cpp.Evaluate("__cplusplus;")
cls.has_byte = 201402 < cppyy.gbl.Cpp.Evaluate("__cplusplus")

def test01_stl_in_std(self):
"""STL classes should live in std:: only"""
Expand Down
4 changes: 2 additions & 2 deletions test/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ def test34_print_empty_collection(self):
v = cppyy.gbl.std.vector[int]()
str(v)

@mark.skipif(not IS_CLANG_REPL, reason="Crashes on Cling")
@mark.xfail(run=IS_CLANG_REPL, reason="Crashes on Cling")
def test35_filesytem(self):
"""Static path object used to crash on destruction"""

Expand All @@ -1025,7 +1025,7 @@ def test35_filesytem(self):

import cppyy

if cppyy.gbl.Cpp.Evaluate("__cplusplus;") > 201402:
if cppyy.gbl.Cpp.Evaluate("__cplusplus") > 201402:
cppyy.cppdef("""\
#include <filesystem>
std::string stack_std_path() {
Expand Down
4 changes: 2 additions & 2 deletions test/test_stltypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1599,12 +1599,12 @@ def setup_class(cls):
import cppyy
cls.stltypes = cppyy.load_reflection_info(cls.test_dct)

@mark.xfail(condition=not IS_CLANG_REPL, reason="xfail on Cling")
@mark.xfail
def test01_string_through_string_view(self):
"""Usage of std::string_view as formal argument"""

import cppyy
if cppyy.gbl.Cpp.Evaluate("__cplusplus;") <= 201402:
if cppyy.gbl.Cpp.Evaluate("__cplusplus") <= 201402:
# string_view exists as of C++17
return
countit = cppyy.gbl.StringViewTest.count
Expand Down
2 changes: 1 addition & 1 deletion test/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def test12_template_aliases(self):
assert iavec[5] == 5

# with variadic template
if cppyy.gbl.Cpp.Evaluate("__cplusplus;") > 201402:
if cppyy.gbl.Cpp.Evaluate("__cplusplus") > 201402:
assert nsup.matryoshka[int, 3].type
assert nsup.matryoshka[int, 3, 4].type
assert nsup.make_vector[int , 3]
Expand Down

0 comments on commit 2b9656e

Please sign in to comment.