Skip to content
Open
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
17 changes: 1 addition & 16 deletions roottest/python/memory/PyROOT_memorytests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

"""Memory tests for PyROOT package."""

import os, sys, unittest

Check failure on line 8 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

roottest/python/memory/PyROOT_memorytests.py:8:1: I001 Import block is un-sorted or un-formatted

Check failure on line 8 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E401)

roottest/python/memory/PyROOT_memorytests.py:8:1: E401 Multiple imports on one line
sys.path.append(os.path.dirname(os.path.dirname(__file__)))

if not os.path.exists('MemTester.C'):
os.chdir(os.path.dirname(__file__))

import ROOT
from ROOT import gROOT, TH1F

Check failure on line 15 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

roottest/python/memory/PyROOT_memorytests.py:15:25: F401 `ROOT.TH1F` imported but unused

Check failure on line 15 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

roottest/python/memory/PyROOT_memorytests.py:14:1: I001 Import block is un-sorted or un-formatted


__all__ = [
Expand Down Expand Up @@ -60,21 +60,6 @@
del b, c
self.assertEqual( MemTester.counter, 0 )

def test2ObjectDestructionCallback( self ):
"""Test ROOT notification on object destruction"""

# create ROOT traced object
a = TH1F( 'memtest_th1f', 'title', 100, -1., 1. )

# locate it
self.assertTrue( a is gROOT.FindObject( 'memtest_th1f' ) )

# destroy it
del a

# should no longer be accessible
self.assertTrue( not gROOT.FindObject( 'memtest_th1f' ) )

def test3ObjectCallHeuristics( self ):
"""Test memory mgmt heuristics for object calls"""

Expand All @@ -87,7 +72,7 @@
# reference calls should not give up ownership
a = MemTester()
self.assertEqual( MemTester.counter, 1 )
MemTester.CallRef( a );

Check failure on line 75 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E703)

roottest/python/memory/PyROOT_memorytests.py:75:29: E703 Statement ends with an unnecessary semicolon
self.assertEqual( MemTester.counter, 1 )

del a
Expand All @@ -104,7 +89,7 @@
counter = 1
self.assertEqual( MemTester.counter, counter )
ROOT.SetHeuristicMemoryPolicy(False)
MemTester.CallPtr( b2 );

Check failure on line 92 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E703)

roottest/python/memory/PyROOT_memorytests.py:92:30: E703 Statement ends with an unnecessary semicolon
self.assertEqual( MemTester.counter, counter )
del b2
counter -= 1
Expand All @@ -114,7 +99,7 @@
counter += 1
self.assertEqual( MemTester.counter, counter )
ROOT.SetHeuristicMemoryPolicy(True)
MemTester.CallPtr( b3 );

Check failure on line 102 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E703)

roottest/python/memory/PyROOT_memorytests.py:102:30: E703 Statement ends with an unnecessary semicolon
self.assertEqual( MemTester.counter, counter )
del b3
self.assertEqual( MemTester.counter, counter )
Expand All @@ -125,7 +110,7 @@
self.assertEqual( MemTester.counter, 0 )
c = MemTester()
self.assertEqual( MemTester.counter, 1 )
MemTester.CallPtr( c );

Check failure on line 113 in roottest/python/memory/PyROOT_memorytests.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E703)

roottest/python/memory/PyROOT_memorytests.py:113:29: E703 Statement ends with an unnecessary semicolon
self.assertEqual( MemTester.counter, 1 )
klass = gROOT.GetClass( 'MemTester' )
klass.Destructor( c )
Expand All @@ -139,7 +124,7 @@
"""Derived classes should call base dtor automatically"""

MemTester = ROOT.MemTester

class D1( MemTester ):
def __init__( self ):
MemTester.__init__( self )
Expand Down
Loading