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
22 changes: 22 additions & 0 deletions roottest/python/cpp/PyROOT_advancedtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
What remains are tests without (green) upstream equivalents.
"""

import sys, os, unittest

Check failure on line 15 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

roottest/python/cpp/PyROOT_advancedtests.py:15:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 15 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E401)

roottest/python/cpp/PyROOT_advancedtests.py:15:1: E401 Multiple imports on one line help: Split imports

Check failure on line 15 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

roottest/python/cpp/PyROOT_advancedtests.py:15:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 15 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E401)

roottest/python/cpp/PyROOT_advancedtests.py:15:1: E401 Multiple imports on one line help: Split imports
sys.path.append(os.path.dirname(os.path.dirname(__file__)))

import ROOT
from ROOT import gROOT
from common import *

Check failure on line 20 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F403)

roottest/python/cpp/PyROOT_advancedtests.py:20:1: F403 `from common import *` used; unable to detect undefined names

Check failure on line 20 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

roottest/python/cpp/PyROOT_advancedtests.py:18:1: I001 Import block is un-sorted or un-formatted help: Organize imports

Check failure on line 20 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F403)

roottest/python/cpp/PyROOT_advancedtests.py:20:1: F403 `from common import *` used; unable to detect undefined names

Check failure on line 20 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (I001)

roottest/python/cpp/PyROOT_advancedtests.py:18:1: I001 Import block is un-sorted or un-formatted help: Organize imports

__all__ = [
'Cpp05AssignToRefArbitraryClass',
Expand All @@ -26,13 +26,14 @@
'Cpp10StandardExceptions',
'Cpp12NamespaceLazyFunctions',
'Cpp14CopyConstructorOrdering',
'Cpp15StdComplex'
]

gROOT.LoadMacro( "AdvancedCpp.C+" )


### Return by reference should call assignment operator ======================
class Cpp05AssignToRefArbitraryClass( MyTestCase ):

Check failure on line 36 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:36:39: F405 `MyTestCase` may be undefined, or defined from star imports

Check failure on line 36 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:36:39: F405 `MyTestCase` may be undefined, or defined from star imports
def test2NiceErrorMessageReturnByRef( self ):
"""Want nice error message of failing assign by reference"""

Expand All @@ -49,7 +50,7 @@


### Check global operator== overload =========================================
class Cpp07GloballyOverloadedComparator( MyTestCase ):

Check failure on line 53 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:53:42: F405 `MyTestCase` may be undefined, or defined from star imports

Check failure on line 53 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:53:42: F405 `MyTestCase` may be undefined, or defined from star imports
def test3DirectUseComparator( self ):
"""Check that a namespaced global operator!=/== can be used directly"""

Expand All @@ -68,7 +69,7 @@
# NOTE: kept although covered by cppyy's
# test_advancedcpp.py::test21_access_to_global_variables, because that
# upstream test is currently marked xfail.
class Cpp08GlobalVariables( MyTestCase ):

Check failure on line 72 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:72:29: F405 `MyTestCase` may be undefined, or defined from star imports

Check failure on line 72 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:72:29: F405 `MyTestCase` may be undefined, or defined from star imports
def test1DoubleArray( self ):
"""Verify access to array of doubles"""

Expand Down Expand Up @@ -106,7 +107,7 @@


### Test usability of standard exceptions ====================================
class Cpp10StandardExceptions( MyTestCase ):

Check failure on line 110 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:110:32: F405 `MyTestCase` may be undefined, or defined from star imports

Check failure on line 110 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (F405)

roottest/python/cpp/PyROOT_advancedtests.py:110:32: F405 `MyTestCase` may be undefined, or defined from star imports
def test2ExceptionBoolValue(self):
"""Test boolean value of exception object"""
# ROOT-10870
Expand Down Expand Up @@ -137,8 +138,8 @@

handle = ROOT.test2Exception.Handle('int')()

self.assertTrue(not handle.returnsNull());

Check failure on line 141 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E703)

roottest/python/cpp/PyROOT_advancedtests.py:141:48: E703 Statement ends with an unnecessary semicolon help: Remove unnecessary semicolon

Check failure on line 141 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E703)

roottest/python/cpp/PyROOT_advancedtests.py:141:48: E703 Statement ends with an unnecessary semicolon help: Remove unnecessary semicolon
self.assertTrue(handle.returnsNotNull);

Check failure on line 142 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E703)

roottest/python/cpp/PyROOT_advancedtests.py:142:45: E703 Statement ends with an unnecessary semicolon help: Remove unnecessary semicolon

Check failure on line 142 in roottest/python/cpp/PyROOT_advancedtests.py

View workflow job for this annotation

GitHub Actions / ruff

ruff (E703)

roottest/python/cpp/PyROOT_advancedtests.py:142:45: E703 Statement ends with an unnecessary semicolon help: Remove unnecessary semicolon


### Test lookup of lazily created functions in namespaces ====================
Expand Down Expand Up @@ -221,6 +222,27 @@
self.assertEqual( m3.m_d1, m2.m_d1 )
self.assertEqual( m3.m_d2, m2.m_d2 )

# Tests #17157
class Cpp15StdComplex( MyTestCase ):
def testSum( self ):
"""Behaviour of std complex in operations"""
import cppyy
c = cppyy.gbl.std.complex['double'](1, 1)
try:
s = 1 + c
except NotImplementedError:
pass

try:
s = 1. + c
except NotImplementedError:
pass

try:
s = c + 1.
except NotImplementedError:
pass


## actual test run
if __name__ == '__main__':
Expand Down
Loading