appease ruff v0.0.263

This commit is contained in:
Ralf W. Grosse-Kunstleve 2023-04-28 22:03:53 -07:00
parent 7d92147666
commit 9cbf45d4ea
3 changed files with 10 additions and 10 deletions

View File

@ -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

View File

@ -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

View File

@ -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).