From db529c805ca2fe666de8bcc617ab9f1c13a56c48 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 12 Jan 2021 11:46:23 -0800 Subject: [PATCH] flake8 cleanup --- tests/test_cpp_base_py_derived.py | 42 +++++++++---------- tests/test_private_first_base.py | 1 - tests/test_smart_ptr_base_derived.py | 2 + tests/test_smart_ptr_private_first_base.py | 1 - tests/test_type_caster_bare_interface_demo.py | 1 - 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/tests/test_cpp_base_py_derived.py b/tests/test_cpp_base_py_derived.py index ca30f0f98..3d601d372 100644 --- a/tests/test_cpp_base_py_derived.py +++ b/tests/test_cpp_base_py_derived.py @@ -2,37 +2,35 @@ # pybind11 equivalent of Boost.Python test: # https://github.com/rwgk/rwgk_tbx/blob/6c9a6d6bc72d5c1b8609724433259c5b47178680/tst_cpp_base_py_derived.py # See also: https://github.com/pybind/pybind11/issues/1333 (this was the starting point) -import pytest from pybind11_tests import cpp_base_py_derived as m -class drvd(m.base): +class drvd(m.base): # noqa: N801 + def __init__(self, _num=200): + super().__init__() + self._drvd_num = _num - def __init__(self, _num = 200): - super().__init__() - self._drvd_num = _num + def get_num(self): + return self._drvd_num - def get_num(self): - return self._drvd_num - - def clone(self): - return drvd(250) + def clone(self): + return drvd(250) def test_base(): - b = m.base() - assert b.get_num() == 100 - assert m.get_num(b) == 100 - bc = b.clone() - assert bc.get_num() == 150 - assert m.clone_get_num(b) == 103157 + b = m.base() + assert b.get_num() == 100 + assert m.get_num(b) == 100 + bc = b.clone() + assert bc.get_num() == 150 + assert m.clone_get_num(b) == 103157 def test_drvd(): - d = drvd() - assert d.get_num() == 200 - assert m.get_num(d) == 200 - dc = d.clone() - assert dc.get_num() == 250 - assert m.clone_get_num(d) == 203257 + d = drvd() + assert d.get_num() == 200 + assert m.get_num(d) == 200 + dc = d.clone() + assert dc.get_num() == 250 + assert m.clone_get_num(d) == 203257 diff --git a/tests/test_private_first_base.py b/tests/test_private_first_base.py index 7004da50e..36cc60e1e 100644 --- a/tests/test_private_first_base.py +++ b/tests/test_private_first_base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import pytest from pybind11_tests import private_first_base as m diff --git a/tests/test_smart_ptr_base_derived.py b/tests/test_smart_ptr_base_derived.py index b57c364da..534b5e5c3 100644 --- a/tests/test_smart_ptr_base_derived.py +++ b/tests/test_smart_ptr_base_derived.py @@ -7,6 +7,7 @@ CBASE_GET_INT_RESULT = 90146438 CDERIVED_GET_INT_RESULT = 31607978 VDERIVED_GET_INT_RESULT = 29852452 + def test_concrete(): m.to_cout("") m.to_cout("") @@ -22,6 +23,7 @@ def test_concrete(): m.pass_shared_cderived(cb) m.to_cout("") + def test_virtual(): m.to_cout("") m.to_cout("") diff --git a/tests/test_smart_ptr_private_first_base.py b/tests/test_smart_ptr_private_first_base.py index e085646a9..db17e787f 100644 --- a/tests/test_smart_ptr_private_first_base.py +++ b/tests/test_smart_ptr_private_first_base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import pytest from pybind11_tests import smart_ptr_private_first_base as m diff --git a/tests/test_type_caster_bare_interface_demo.py b/tests/test_type_caster_bare_interface_demo.py index 35ae0ee29..6152d88a6 100644 --- a/tests/test_type_caster_bare_interface_demo.py +++ b/tests/test_type_caster_bare_interface_demo.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -import pytest from pybind11_tests import type_caster_bare_interface_demo as m