diff options
Diffstat (limited to 'sources/shiboken6/tests/samplebinding/class_fields_test.py')
| -rw-r--r-- | sources/shiboken6/tests/samplebinding/class_fields_test.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/shiboken6/tests/samplebinding/class_fields_test.py b/sources/shiboken6/tests/samplebinding/class_fields_test.py index 63b8b8fa3..11052c5ba 100644 --- a/sources/shiboken6/tests/samplebinding/class_fields_test.py +++ b/sources/shiboken6/tests/samplebinding/class_fields_test.py @@ -17,6 +17,9 @@ init_paths() from sample import Derived, Point, ObjectType +REF_COUNT_DELTA = 2 if sys.version_info >= (3, 14) else 1 + + class TestAccessingCppFields(unittest.TestCase): '''Simple test case for accessing the exposed C++ class fields.''' @@ -125,7 +128,7 @@ class TestAccessingCppFields(unittest.TestCase): refcount1 = sys.getrefcount(o1) d.objectTypeField = o1 self.assertEqual(d.objectTypeField, o1) - self.assertEqual(sys.getrefcount(d.objectTypeField), refcount1 + 1) + self.assertEqual(sys.getrefcount(d.objectTypeField), refcount1 + REF_COUNT_DELTA) # attributing a new object to instance's field should decrease the previous # object's reference count @@ -134,7 +137,7 @@ class TestAccessingCppFields(unittest.TestCase): d.objectTypeField = o2 self.assertEqual(d.objectTypeField, o2) self.assertEqual(sys.getrefcount(o1), refcount1) - self.assertEqual(sys.getrefcount(d.objectTypeField), refcount2 + 1) + self.assertEqual(sys.getrefcount(d.objectTypeField), refcount2 + REF_COUNT_DELTA) @unittest.skipUnless(hasattr(sys, "getrefcount"), f"{sys.implementation.name} has no refcount") def testRefCountingOfReferredObjectAfterDeletingReferrer(self): |
