From 9cbf45d4ea295154a4e1ad9be68226f3e4ed6643 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Apr 2023 22:03:53 -0700 Subject: [PATCH] appease ruff v0.0.263 --- tests/test_class_sh_property.py | 6 +++--- tests/test_class_sh_trampoline_self_life_support.py | 2 +- tests/test_class_sh_trampoline_shared_from_this.py | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_class_sh_property.py b/tests/test_class_sh_property.py index ad8e4d348..7142b4ea8 100644 --- a/tests/test_class_sh_property.py +++ b/tests/test_class_sh_property.py @@ -92,7 +92,7 @@ def test_uqp(m_attr_readwrite, msg): field_orig.num = 39 setattr(outer, m_attr_readwrite, field_orig) with pytest.raises(ValueError) as excinfo: - field_orig.num + _ = field_orig.num assert ( msg(excinfo.value) == "Missing value for wrapped C++ type: Python instance was disowned." @@ -103,7 +103,7 @@ def test_uqp(m_attr_readwrite, msg): field_retr1.num = 93 setattr(outer, m_attr_readwrite, field_retr1) with pytest.raises(ValueError): - field_retr1.num + _ = field_retr1.num field_retr2 = getattr(outer, m_attr_readwrite) assert field_retr2.num == 93 @@ -150,7 +150,7 @@ def test_unique_ptr_field_proxy_poc(m_attr): assert field_proxy.num == 45 assert field_proxy.num == 45 with pytest.raises(AttributeError): - field_proxy.xyz + _ = field_proxy.xyz assert field_proxy.num == 45 field_proxy.num = 82 assert field_proxy.num == 82 diff --git a/tests/test_class_sh_trampoline_self_life_support.py b/tests/test_class_sh_trampoline_self_life_support.py index 74d1e0e91..3bd12bc4f 100644 --- a/tests/test_class_sh_trampoline_self_life_support.py +++ b/tests/test_class_sh_trampoline_self_life_support.py @@ -14,7 +14,7 @@ def test_m_big5(): assert o1 is not obj assert o1.history == "Seed" with pytest.raises(ValueError) as excinfo: - obj.history + _ = obj.history assert "Python instance was disowned" in str(excinfo.value) assert o2 is None diff --git a/tests/test_class_sh_trampoline_shared_from_this.py b/tests/test_class_sh_trampoline_shared_from_this.py index 22c407290..eeb7bb8ac 100644 --- a/tests/test_class_sh_trampoline_shared_from_this.py +++ b/tests/test_class_sh_trampoline_shared_from_this.py @@ -29,7 +29,7 @@ def test_release_and_shared_from_this_leak(): obj = PySft("") while True: m.pass_shared_ptr(obj) - assert obj.history == "" + assert not obj.history assert m.use_count(obj) == 1 break # Comment out for manual leak checking (use `top` command). @@ -82,11 +82,11 @@ def test_release_and_stash_leak(): while True: stash1 = m.SftSharedPtrStash(1) stash1.Add(obj) - assert obj.history == "" + assert not obj.history assert m.use_count(obj) == 2 assert stash1.use_count(0) == 1 stash1.Add(obj) - assert obj.history == "" + assert not obj.history assert m.use_count(obj) == 3 assert stash1.use_count(0) == 2 assert stash1.use_count(1) == 2 @@ -117,10 +117,10 @@ def test_release_and_stash_via_shared_from_this_leak(): stash1.AddSharedFromThis(obj) assert str(exc_info.value) == "bad_weak_ptr" stash1.Add(obj) - assert obj.history == "" + assert not obj.history assert stash1.use_count(0) == 1 stash1.AddSharedFromThis(obj) - assert obj.history == "" + assert not obj.history assert stash1.use_count(0) == 2 assert stash1.use_count(1) == 2 break # Comment out for manual leak checking (use `top` command). @@ -186,7 +186,7 @@ def test_multiple_registered_instances_for_same_pointee_leak(): stash1.Add(m.Sft(obj0)) assert stash1.use_count(0) == 1 assert stash1.use_count(1) == 1 - assert obj0.history == "" + assert not obj0.history break # Comment out for manual leak checking (use `top` command).