From 9b78303d7b99c234662c188bd4b4ad05ae19a701 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 22 Feb 2023 12:51:01 -0800 Subject: [PATCH] trivial manual fixes for ruff --- tests/test_class_sh_basic.py | 2 +- tests/test_class_sh_disowning_mi.py | 2 +- tests/test_class_sh_property.py | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_class_sh_basic.py b/tests/test_class_sh_basic.py index a62166f6a..95460d9dc 100644 --- a/tests/test_class_sh_basic.py +++ b/tests/test_class_sh_basic.py @@ -121,7 +121,7 @@ def test_unique_ptr_roundtrip(num_round_trips=1000): # due to pybind11/detail/smart_holder_type_casters.h:689 # I think, we need to provide more cast operators. @pytest.mark.skip() -def test_unique_ptr_cref_roundtrip(num_round_trips=1000): +def test_unique_ptr_cref_roundtrip(): orig = m.atyp("passenger") id_orig = id(orig) mtxt_orig = m.get_mtxt(orig) diff --git a/tests/test_class_sh_disowning_mi.py b/tests/test_class_sh_disowning_mi.py index a331c1796..1a3741321 100644 --- a/tests/test_class_sh_disowning_mi.py +++ b/tests/test_class_sh_disowning_mi.py @@ -20,7 +20,7 @@ def is_disowned(callable_method): try: callable_method() except ValueError as e: - assert ( + assert ( # noqa: PT017 str(e) == "Missing value for wrapped C++ type: Python instance was disowned." ) diff --git a/tests/test_class_sh_property.py b/tests/test_class_sh_property.py index d23ce549b..ad8e4d348 100644 --- a/tests/test_class_sh_property.py +++ b/tests/test_class_sh_property.py @@ -8,7 +8,7 @@ from pybind11_tests import class_sh_property as m @pytest.mark.xfail("env.PYPY", reason="gc after `del field` is apparently deferred") -@pytest.mark.parametrize("m_attr", ("m_valu_readonly", "m_valu_readwrite")) +@pytest.mark.parametrize("m_attr", ["m_valu_readonly", "m_valu_readwrite"]) def test_valu_getter(msg, m_attr): # Reduced from PyCLIF test: # https://github.com/google/clif/blob/c371a6d4b28d25d53a16e6d2a6d97305fb1be25a/clif/testing/python/nested_fields_test.py#L56 @@ -39,7 +39,7 @@ def test_valu_setter(): assert outer.m_valu_readwrite.num == 35 -@pytest.mark.parametrize("m_attr", ("m_shmp", "m_shcp")) +@pytest.mark.parametrize("m_attr", ["m_shmp", "m_shcp"]) def test_shp(m_attr): m_attr_readonly = m_attr + "_readonly" m_attr_readwrite = m_attr + "_readwrite" @@ -66,8 +66,8 @@ def test_shp(m_attr): (m.Field, -99, m.Outer), ], ) -@pytest.mark.parametrize("m_attr", ("m_mptr", "m_cptr")) -@pytest.mark.parametrize("r_kind", ("_readonly", "_readwrite")) +@pytest.mark.parametrize("m_attr", ["m_mptr", "m_cptr"]) +@pytest.mark.parametrize("r_kind", ["_readonly", "_readwrite"]) def test_ptr(field_type, num_default, outer_type, m_attr, r_kind): m_attr_r_kind = m_attr + r_kind outer = outer_type() @@ -84,7 +84,7 @@ def test_ptr(field_type, num_default, outer_type, m_attr, r_kind): assert getattr(outer, m_attr_r_kind).num == 76 -@pytest.mark.parametrize("m_attr_readwrite", ("m_uqmp_readwrite", "m_uqcp_readwrite")) +@pytest.mark.parametrize("m_attr_readwrite", ["m_uqmp_readwrite", "m_uqcp_readwrite"]) def test_uqp(m_attr_readwrite, msg): outer = m.Outer() assert getattr(outer, m_attr_readwrite) is None @@ -139,8 +139,8 @@ def _proxy_dereference(proxy, xxxattr, *args, **kwargs): setattr(obj, field_name, field) # Disowns the temporary Python object (field). -@pytest.mark.parametrize("m_attr", ("m_uqmp", "m_uqcp")) -def test_unique_ptr_field_proxy_poc(m_attr, msg): +@pytest.mark.parametrize("m_attr", ["m_uqmp", "m_uqcp"]) +def test_unique_ptr_field_proxy_poc(m_attr): m_attr_readwrite = m_attr + "_readwrite" outer = m.Outer() field_orig = m.Field()