diff --git a/extern/pybind11/noxfile.py b/extern/pybind11/noxfile.py index 6d162a24..021ced24 100644 --- a/extern/pybind11/noxfile.py +++ b/extern/pybind11/noxfile.py @@ -102,4 +102,6 @@ def build(session: nox.Session) -> None: session.log("Building normal files") session.run("python", "-m", "build", *session.posargs) session.log("Building pybind11-global files (PYBIND11_GLOBAL_SDIST=1)") - session.run("python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"}) + session.run( + "python", "-m", "build", *session.posargs, env={"PYBIND11_GLOBAL_SDIST": "1"} + ) diff --git a/extern/pybind11/pybind11/setup_helpers.py b/extern/pybind11/pybind11/setup_helpers.py index 3f052a55..b9b433b6 100644 --- a/extern/pybind11/pybind11/setup_helpers.py +++ b/extern/pybind11/pybind11/setup_helpers.py @@ -174,7 +174,9 @@ def cxx_std(self) -> int: @cxx_std.setter def cxx_std(self, level: int) -> None: if self._cxx_level: - warnings.warn("You cannot safely change the cxx_level after setting it!", stacklevel=2) + warnings.warn( + "You cannot safely change the cxx_level after setting it!", stacklevel=2 + ) # MSVC 2015 Update 3 and later only have 14 (and later 17) modes, so # force a valid flag here. diff --git a/extern/pybind11/setup.py b/extern/pybind11/setup.py index bd22918f..68573519 100644 --- a/extern/pybind11/setup.py +++ b/extern/pybind11/setup.py @@ -16,7 +16,9 @@ import setuptools.command.sdist DIR = Path(__file__).parent.absolute() -VERSION_REGEX = re.compile(r"^\s*#\s*define\s+PYBIND11_VERSION_([A-Z]+)\s+(.*)$", re.MULTILINE) +VERSION_REGEX = re.compile( + r"^\s*#\s*define\s+PYBIND11_VERSION_([A-Z]+)\s+(.*)$", re.MULTILINE +) VERSION_FILE = Path("pybind11/_version.py") COMMON_FILE = Path("include/pybind11/detail/common.h") @@ -50,7 +52,9 @@ def build_expected_version_hex(matches: Dict[str, str]) -> str: global_sdist = os.environ.get("PYBIND11_GLOBAL_SDIST", False) -setup_py = Path("tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in") +setup_py = Path( + "tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in" +) extra_cmd = 'cmdclass["sdist"] = SDist\n' to_src = ( @@ -80,7 +84,9 @@ def build_expected_version_hex(matches: Dict[str, str]) -> str: # TODO: use literals & overload (typing extensions or Python 3.8) -def get_and_replace(filename: Path, binary: bool = False, **opts: str) -> Union[bytes, str]: +def get_and_replace( + filename: Path, binary: bool = False, **opts: str +) -> Union[bytes, str]: if binary: contents = filename.read_bytes() return string.Template(contents.decode()).substitute(opts).encode() @@ -125,7 +131,9 @@ def remove_output(*sources: str) -> Iterator[None]: ] if "CMAKE_ARGS" in os.environ: fcommand = [ - c for c in os.environ["CMAKE_ARGS"].split() if "DCMAKE_INSTALL_PREFIX" not in c + c + for c in os.environ["CMAKE_ARGS"].split() + if "DCMAKE_INSTALL_PREFIX" not in c ] cmd += fcommand subprocess.run(cmd, check=True, cwd=DIR, stdout=sys.stdout, stderr=sys.stderr) diff --git a/extern/pybind11/tests/conftest.py b/extern/pybind11/tests/conftest.py index 683b97c0..c24d51d4 100644 --- a/extern/pybind11/tests/conftest.py +++ b/extern/pybind11/tests/conftest.py @@ -58,7 +58,9 @@ def _split_and_sort(s): def _make_explanation(a, b): """Explanation for a failed assert -- the a and b arguments are List[str]""" - return ["--- actual / +++ expected"] + [line.strip("\n") for line in difflib.ndiff(a, b)] + return ["--- actual / +++ expected"] + [ + line.strip("\n") for line in difflib.ndiff(a, b) + ] class Output: @@ -73,7 +75,11 @@ def __str__(self): def __eq__(self, other): # Ignore constructor/destructor output which is prefixed with "###" - a = [line for line in self.string.strip().splitlines() if not line.startswith("###")] + a = [ + line + for line in self.string.strip().splitlines() + if not line.startswith("###") + ] b = _strip_and_dedent(other).splitlines() if a == b: return True diff --git a/extern/pybind11/tests/extra_python_package/test_files.py b/extern/pybind11/tests/extra_python_package/test_files.py index 42068a85..dd6393bf 100644 --- a/extern/pybind11/tests/extra_python_package/test_files.py +++ b/extern/pybind11/tests/extra_python_package/test_files.py @@ -137,7 +137,9 @@ def normalize_line_endings(value: bytes) -> bytes: def test_build_sdist(monkeypatch, tmpdir): monkeypatch.chdir(MAIN_DIR) - subprocess.run([sys.executable, "-m", "build", "--sdist", f"--outdir={tmpdir}"], check=True) + subprocess.run( + [sys.executable, "-m", "build", "--sdist", f"--outdir={tmpdir}"], check=True + ) (sdist,) = tmpdir.visit("*.tar.gz") @@ -149,9 +151,14 @@ def test_build_sdist(monkeypatch, tmpdir): setup_py = read_tz_file(tar, "setup.py") pyproject_toml = read_tz_file(tar, "pyproject.toml") pkgconfig = read_tz_file(tar, "pybind11/share/pkgconfig/pybind11.pc") - cmake_cfg = read_tz_file(tar, "pybind11/share/cmake/pybind11/pybind11Config.cmake") + cmake_cfg = read_tz_file( + tar, "pybind11/share/cmake/pybind11/pybind11Config.cmake" + ) - assert 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")' in cmake_cfg.decode("utf-8") + assert ( + 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")' + in cmake_cfg.decode("utf-8") + ) files = {f"pybind11/{n}" for n in all_files} files |= sdist_files @@ -180,7 +187,9 @@ def test_build_sdist(monkeypatch, tmpdir): def test_build_global_dist(monkeypatch, tmpdir): monkeypatch.chdir(MAIN_DIR) monkeypatch.setenv("PYBIND11_GLOBAL_SDIST", "1") - subprocess.run([sys.executable, "-m", "build", "--sdist", "--outdir", str(tmpdir)], check=True) + subprocess.run( + [sys.executable, "-m", "build", "--sdist", "--outdir", str(tmpdir)], check=True + ) (sdist,) = tmpdir.visit("*.tar.gz") @@ -192,9 +201,14 @@ def test_build_global_dist(monkeypatch, tmpdir): setup_py = read_tz_file(tar, "setup.py") pyproject_toml = read_tz_file(tar, "pyproject.toml") pkgconfig = read_tz_file(tar, "pybind11/share/pkgconfig/pybind11.pc") - cmake_cfg = read_tz_file(tar, "pybind11/share/cmake/pybind11/pybind11Config.cmake") + cmake_cfg = read_tz_file( + tar, "pybind11/share/cmake/pybind11/pybind11Config.cmake" + ) - assert 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")' in cmake_cfg.decode("utf-8") + assert ( + 'set(pybind11_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")' + in cmake_cfg.decode("utf-8") + ) files = {f"pybind11/{n}" for n in all_files} files |= sdist_files @@ -221,7 +235,9 @@ def test_build_global_dist(monkeypatch, tmpdir): def tests_build_wheel(monkeypatch, tmpdir): monkeypatch.chdir(MAIN_DIR) - subprocess.run([sys.executable, "-m", "pip", "wheel", ".", "-w", str(tmpdir)], check=True) + subprocess.run( + [sys.executable, "-m", "pip", "wheel", ".", "-w", str(tmpdir)], check=True + ) (wheel,) = tmpdir.visit("*.whl") @@ -247,7 +263,9 @@ def tests_build_global_wheel(monkeypatch, tmpdir): monkeypatch.chdir(MAIN_DIR) monkeypatch.setenv("PYBIND11_GLOBAL_SDIST", "1") - subprocess.run([sys.executable, "-m", "pip", "wheel", ".", "-w", str(tmpdir)], check=True) + subprocess.run( + [sys.executable, "-m", "pip", "wheel", ".", "-w", str(tmpdir)], check=True + ) (wheel,) = tmpdir.visit("*.whl") diff --git a/extern/pybind11/tests/extra_setuptools/test_setuphelper.py b/extern/pybind11/tests/extra_setuptools/test_setuphelper.py index 643561d8..d5d3093b 100644 --- a/extern/pybind11/tests/extra_setuptools/test_setuphelper.py +++ b/extern/pybind11/tests/extra_setuptools/test_setuphelper.py @@ -88,7 +88,9 @@ def test_simple_setup_py(monkeypatch, tmpdir, parallel, std): for item in tmpdir.listdir(): print(item.basename) - assert len([f for f in tmpdir.listdir() if f.basename.startswith("simple_setup")]) == 1 + assert ( + len([f for f in tmpdir.listdir() if f.basename.startswith("simple_setup")]) == 1 + ) assert len(list(tmpdir.listdir())) == 4 # two files + output + build_dir (tmpdir / "test.py").write_text( @@ -101,7 +103,9 @@ def test_simple_setup_py(monkeypatch, tmpdir, parallel, std): encoding="ascii", ) - subprocess.check_call([sys.executable, "test.py"], stdout=sys.stdout, stderr=sys.stderr) + subprocess.check_call( + [sys.executable, "test.py"], stdout=sys.stdout, stderr=sys.stderr + ) def test_intree_extensions(monkeypatch, tmpdir): diff --git a/extern/pybind11/tests/test_buffers.py b/extern/pybind11/tests/test_buffers.py index 19b7a61a..8354b68c 100644 --- a/extern/pybind11/tests/test_buffers.py +++ b/extern/pybind11/tests/test_buffers.py @@ -36,7 +36,9 @@ def test_from_python(): # https://foss.heptapod.net/pypy/pypy/-/issues/2444 # TODO: fix on recent PyPy -@pytest.mark.xfail(env.PYPY, reason="PyPy 7.3.7 doesn't clear this anymore", strict=False) +@pytest.mark.xfail( + env.PYPY, reason="PyPy 7.3.7 doesn't clear this anymore", strict=False +) def test_to_python(): mat = m.Matrix(5, 4) assert memoryview(mat).shape == (5, 4) diff --git a/extern/pybind11/tests/test_builtin_casters.py b/extern/pybind11/tests/test_builtin_casters.py index 5f0a1267..d38ae680 100644 --- a/extern/pybind11/tests/test_builtin_casters.py +++ b/extern/pybind11/tests/test_builtin_casters.py @@ -56,7 +56,9 @@ def toobig_message(r): assert m.ord_char("a") == 0x61 # simple ASCII assert m.ord_char_lv("b") == 0x62 - assert m.ord_char("é") == 0xE9 # requires 2 bytes in utf-8, but can be stuffed in a char + assert ( + m.ord_char("é") == 0xE9 + ) # requires 2 bytes in utf-8, but can be stuffed in a char with pytest.raises(ValueError) as excinfo: assert m.ord_char("Ā") == 0x100 # requires 2 bytes, doesn't fit in a char assert str(excinfo.value) == toobig_message(0x100) @@ -106,7 +108,9 @@ def toobig_message(r): if hasattr(m, "has_u8string"): assert m.ord_char8("a") == 0x61 # simple ASCII assert m.ord_char8_lv("b") == 0x62 - assert m.ord_char8("é") == 0xE9 # requires 2 bytes in utf-8, but can be stuffed in a char + assert ( + m.ord_char8("é") == 0xE9 + ) # requires 2 bytes in utf-8, but can be stuffed in a char with pytest.raises(ValueError) as excinfo: assert m.ord_char8("Ā") == 0x100 # requires 2 bytes, doesn't fit in a char assert str(excinfo.value) == toobig_message(0x100) diff --git a/extern/pybind11/tests/test_callbacks.py b/extern/pybind11/tests/test_callbacks.py index c590d01b..4a652f53 100644 --- a/extern/pybind11/tests/test_callbacks.py +++ b/extern/pybind11/tests/test_callbacks.py @@ -103,17 +103,21 @@ def test_cpp_callable_cleanup(): def test_cpp_function_roundtrip(): """Test if passing a function pointer from C++ -> Python -> C++ yields the original pointer""" - assert m.test_dummy_function(m.dummy_function) == "matches dummy_function: eval(1) = 2" + assert ( + m.test_dummy_function(m.dummy_function) == "matches dummy_function: eval(1) = 2" + ) assert ( m.test_dummy_function(m.roundtrip(m.dummy_function)) == "matches dummy_function: eval(1) = 2" ) assert ( - m.test_dummy_function(m.dummy_function_overloaded) == "matches dummy_function: eval(1) = 2" + m.test_dummy_function(m.dummy_function_overloaded) + == "matches dummy_function: eval(1) = 2" ) assert m.roundtrip(None, expect_none=True) is None assert ( - m.test_dummy_function(lambda x: x + 2) == "can't convert to function pointer: eval(1) = 3" + m.test_dummy_function(lambda x: x + 2) + == "can't convert to function pointer: eval(1) = 3" ) with pytest.raises(TypeError) as excinfo: @@ -206,7 +210,9 @@ def test_custom_func(): assert m.roundtrip(m.custom_function)(4) == 36 -@pytest.mark.skipif(m.custom_function2 is None, reason="Current PYBIND11_INTERNALS_VERSION too low") +@pytest.mark.skipif( + m.custom_function2 is None, reason="Current PYBIND11_INTERNALS_VERSION too low" +) def test_custom_func2(): assert m.custom_function2(3) == 27 assert m.roundtrip(m.custom_function2)(3) == 27 diff --git a/extern/pybind11/tests/test_class.py b/extern/pybind11/tests/test_class.py index af8507d7..64abac13 100644 --- a/extern/pybind11/tests/test_class.py +++ b/extern/pybind11/tests/test_class.py @@ -45,7 +45,9 @@ def test_type(): with pytest.raises(RuntimeError) as execinfo: m.check_type(0) - assert "pybind11::detail::get_type_info: unable to find type info" in str(execinfo.value) + assert "pybind11::detail::get_type_info: unable to find type info" in str( + execinfo.value + ) assert "Invalid" in str(execinfo.value) # Currently not supported @@ -480,4 +482,7 @@ class ClassScope: def test_pr4220_tripped_over_this(): - assert m.Empty0().get_msg() == "This is really only meant to exercise successful compilation." + assert ( + m.Empty0().get_msg() + == "This is really only meant to exercise successful compilation." + ) diff --git a/extern/pybind11/tests/test_docstring_options.py b/extern/pybind11/tests/test_docstring_options.py index a3c38a65..e6f5a9d9 100644 --- a/extern/pybind11/tests/test_docstring_options.py +++ b/extern/pybind11/tests/test_docstring_options.py @@ -41,10 +41,16 @@ def test_docstring_options(): assert not m.DocstringTestFoo.value_prop.__doc__ # Check existig behaviour of enum docstings - assert m.DocstringTestEnum1.__doc__ == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2" + assert ( + m.DocstringTestEnum1.__doc__ + == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2" + ) # options.enable_enum_members_docstring() - assert m.DocstringTestEnum2.__doc__ == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2" + assert ( + m.DocstringTestEnum2.__doc__ + == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2" + ) # options.disable_enum_members_docstring() assert m.DocstringTestEnum3.__doc__ == "Enum docstring" diff --git a/extern/pybind11/tests/test_eigen_matrix.py b/extern/pybind11/tests/test_eigen_matrix.py index ac4a08af..4407fa6a 100644 --- a/extern/pybind11/tests/test_eigen_matrix.py +++ b/extern/pybind11/tests/test_eigen_matrix.py @@ -49,15 +49,23 @@ def test_partially_fixed(): np.testing.assert_array_equal(m.partial_copy_four_rm_c(ref2), ref2) np.testing.assert_array_equal(m.partial_copy_four_rm_r(ref2[:, 1]), ref2[:, [1]]) np.testing.assert_array_equal(m.partial_copy_four_rm_c(ref2[0, :]), ref2[[0], :]) - np.testing.assert_array_equal(m.partial_copy_four_rm_r(ref2[:, (0, 2)]), ref2[:, (0, 2)]) - np.testing.assert_array_equal(m.partial_copy_four_rm_c(ref2[(3, 1, 2), :]), ref2[(3, 1, 2), :]) + np.testing.assert_array_equal( + m.partial_copy_four_rm_r(ref2[:, (0, 2)]), ref2[:, (0, 2)] + ) + np.testing.assert_array_equal( + m.partial_copy_four_rm_c(ref2[(3, 1, 2), :]), ref2[(3, 1, 2), :] + ) np.testing.assert_array_equal(m.partial_copy_four_cm_r(ref2), ref2) np.testing.assert_array_equal(m.partial_copy_four_cm_c(ref2), ref2) np.testing.assert_array_equal(m.partial_copy_four_cm_r(ref2[:, 1]), ref2[:, [1]]) np.testing.assert_array_equal(m.partial_copy_four_cm_c(ref2[0, :]), ref2[[0], :]) - np.testing.assert_array_equal(m.partial_copy_four_cm_r(ref2[:, (0, 2)]), ref2[:, (0, 2)]) - np.testing.assert_array_equal(m.partial_copy_four_cm_c(ref2[(3, 1, 2), :]), ref2[(3, 1, 2), :]) + np.testing.assert_array_equal( + m.partial_copy_four_cm_r(ref2[:, (0, 2)]), ref2[:, (0, 2)] + ) + np.testing.assert_array_equal( + m.partial_copy_four_cm_c(ref2[(3, 1, 2), :]), ref2[(3, 1, 2), :] + ) # TypeError should be raise for a shape mismatch functions = [ @@ -233,7 +241,9 @@ def test_eigen_ref_to_python(): chols = [m.cholesky1, m.cholesky2, m.cholesky3, m.cholesky4] for i, chol in enumerate(chols, start=1): mymat = chol(np.array([[1.0, 2, 4], [2, 13, 23], [4, 23, 77]])) - assert np.all(mymat == np.array([[1, 0, 0], [2, 3, 0], [4, 5, 6]])), f"cholesky{i}" + assert np.all( + mymat == np.array([[1, 0, 0], [2, 3, 0], [4, 5, 6]]) + ), f"cholesky{i}" def assign_both(a1, a2, r, c, v): @@ -552,7 +562,9 @@ def test_both_ref_mutators(): y = np.array(range(100), dtype="float64").reshape(10, 10) y2 = m.incr_matrix_any(y, 10) # np -> eigen -> np - y3 = m.incr_matrix_any(y2[0::2, 0::2], -33) # np -> eigen -> np slice -> np -> eigen -> np + y3 = m.incr_matrix_any( + y2[0::2, 0::2], -33 + ) # np -> eigen -> np slice -> np -> eigen -> np y4 = m.even_rows(y3) # numpy -> eigen slice -> (... y3) y5 = m.even_cols(y4) # numpy -> eigen slice -> (... y4) y6 = m.incr_matrix_any(y5, 1000) # numpy -> eigen -> (... y5) @@ -574,9 +586,13 @@ def test_nocopy_wrapper(): # get_elem requires a column-contiguous matrix reference, but should be # callable with other types of matrix (via copying): int_matrix_colmajor = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]], order="F") - dbl_matrix_colmajor = np.array(int_matrix_colmajor, dtype="double", order="F", copy=True) + dbl_matrix_colmajor = np.array( + int_matrix_colmajor, dtype="double", order="F", copy=True + ) int_matrix_rowmajor = np.array(int_matrix_colmajor, order="C", copy=True) - dbl_matrix_rowmajor = np.array(int_matrix_rowmajor, dtype="double", order="C", copy=True) + dbl_matrix_rowmajor = np.array( + int_matrix_rowmajor, dtype="double", order="C", copy=True + ) # All should be callable via get_elem: assert m.get_elem(int_matrix_colmajor) == 8 @@ -727,10 +743,14 @@ def test_sparse_signature(doc): def test_issue738(): """Ignore strides on a length-1 dimension (even if they would be incompatible length > 1)""" assert np.all(m.iss738_f1(np.array([[1.0, 2, 3]])) == np.array([[1.0, 102, 203]])) - assert np.all(m.iss738_f1(np.array([[1.0], [2], [3]])) == np.array([[1.0], [12], [23]])) + assert np.all( + m.iss738_f1(np.array([[1.0], [2], [3]])) == np.array([[1.0], [12], [23]]) + ) assert np.all(m.iss738_f2(np.array([[1.0, 2, 3]])) == np.array([[1.0, 102, 203]])) - assert np.all(m.iss738_f2(np.array([[1.0], [2], [3]])) == np.array([[1.0], [12], [23]])) + assert np.all( + m.iss738_f2(np.array([[1.0], [2], [3]])) == np.array([[1.0], [12], [23]]) + ) @pytest.mark.parametrize("func", [m.iss738_f1, m.iss738_f2]) diff --git a/extern/pybind11/tests/test_eigen_tensor.py b/extern/pybind11/tests/test_eigen_tensor.py index 6af1775f..cd54efa0 100644 --- a/extern/pybind11/tests/test_eigen_tensor.py +++ b/extern/pybind11/tests/test_eigen_tensor.py @@ -107,13 +107,17 @@ def test_convert_tensor_to_py(m, func_name): @pytest.mark.parametrize("m", submodules) def test_bad_cpp_to_python_casts(m): - with pytest.raises(RuntimeError, match="Cannot use reference internal when there is no parent"): + with pytest.raises( + RuntimeError, match="Cannot use reference internal when there is no parent" + ): m.reference_tensor_internal() with pytest.raises(RuntimeError, match="Cannot move from a constant reference"): m.move_const_tensor() - with pytest.raises(RuntimeError, match="Cannot take ownership of a const reference"): + with pytest.raises( + RuntimeError, match="Cannot take ownership of a const reference" + ): m.take_const_tensor() with pytest.raises( @@ -125,7 +129,9 @@ def test_bad_cpp_to_python_casts(m): @pytest.mark.parametrize("m", submodules) def test_bad_python_to_cpp_casts(m): - with pytest.raises(TypeError, match=r"^round_trip_tensor\(\): incompatible function arguments"): + with pytest.raises( + TypeError, match=r"^round_trip_tensor\(\): incompatible function arguments" + ): m.round_trip_tensor(np.zeros((2, 3))) with pytest.raises(TypeError, match=r"^Cannot cast array data from dtype"): @@ -137,7 +143,9 @@ def test_bad_python_to_cpp_casts(m): ): m.round_trip_tensor_noconvert(tensor_ref) - assert_equal_tensor_ref(m.round_trip_tensor_noconvert(tensor_ref.astype(np.float64))) + assert_equal_tensor_ref( + m.round_trip_tensor_noconvert(tensor_ref.astype(np.float64)) + ) if m.needed_options == "F": bad_options = "C" @@ -147,17 +155,23 @@ def test_bad_python_to_cpp_casts(m): with pytest.raises( TypeError, match=r"^round_trip_view_tensor\(\): incompatible function arguments" ): - m.round_trip_view_tensor(np.zeros((3, 5, 2), dtype=np.float64, order=bad_options)) + m.round_trip_view_tensor( + np.zeros((3, 5, 2), dtype=np.float64, order=bad_options) + ) with pytest.raises( TypeError, match=r"^round_trip_view_tensor\(\): incompatible function arguments" ): - m.round_trip_view_tensor(np.zeros((3, 5, 2), dtype=np.float32, order=m.needed_options)) + m.round_trip_view_tensor( + np.zeros((3, 5, 2), dtype=np.float32, order=m.needed_options) + ) with pytest.raises( TypeError, match=r"^round_trip_view_tensor\(\): incompatible function arguments" ): - m.round_trip_view_tensor(np.zeros((3, 5), dtype=np.float64, order=m.needed_options)) + m.round_trip_view_tensor( + np.zeros((3, 5), dtype=np.float64, order=m.needed_options) + ) with pytest.raises( TypeError, match=r"^round_trip_view_tensor\(\): incompatible function arguments" @@ -253,9 +267,12 @@ def test_round_trip_references_actually_refer(m): @pytest.mark.parametrize("m", submodules) def test_doc_string(m, doc): - assert doc(m.copy_tensor) == "copy_tensor() -> numpy.ndarray[numpy.float64[?, ?, ?]]" assert ( - doc(m.copy_fixed_tensor) == "copy_fixed_tensor() -> numpy.ndarray[numpy.float64[3, 5, 2]]" + doc(m.copy_tensor) == "copy_tensor() -> numpy.ndarray[numpy.float64[?, ?, ?]]" + ) + assert ( + doc(m.copy_fixed_tensor) + == "copy_fixed_tensor() -> numpy.ndarray[numpy.float64[3, 5, 2]]" ) assert ( doc(m.reference_const_tensor) diff --git a/extern/pybind11/tests/test_exceptions.py b/extern/pybind11/tests/test_exceptions.py index 04caa6c7..8bcefe3d 100644 --- a/extern/pybind11/tests/test_exceptions.py +++ b/extern/pybind11/tests/test_exceptions.py @@ -160,7 +160,9 @@ def test_custom(msg): # Can we fall-through to the default handler? with pytest.raises(RuntimeError) as excinfo: m.throws_logic_error() - assert msg(excinfo.value) == "this error should fall through to the standard handler" + assert ( + msg(excinfo.value) == "this error should fall through to the standard handler" + ) # OverFlow error translation. with pytest.raises(OverflowError) as excinfo: @@ -308,7 +310,9 @@ def __str__(self): (FlakyException, ("happy",), "FlakyException: FlakyException.__str__"), ), ) -def test_error_already_set_what_with_happy_exceptions(exc_type, exc_value, expected_what): +def test_error_already_set_what_with_happy_exceptions( + exc_type, exc_value, expected_what +): what, py_err_set_after_what = m.error_already_set_what(exc_type, exc_value) assert not py_err_set_after_what assert what == expected_what @@ -333,7 +337,9 @@ def test_flaky_exception_failure_point_init(): def test_flaky_exception_failure_point_str(): - what, py_err_set_after_what = m.error_already_set_what(FlakyException, ("failure_point_str",)) + what, py_err_set_after_what = m.error_already_set_what( + FlakyException, ("failure_point_str",) + ) assert not py_err_set_after_what lines = what.splitlines() if env.PYPY and len(lines) == 3: diff --git a/extern/pybind11/tests/test_factory_constructors.py b/extern/pybind11/tests/test_factory_constructors.py index 0ea8d35c..120a587c 100644 --- a/extern/pybind11/tests/test_factory_constructors.py +++ b/extern/pybind11/tests/test_factory_constructors.py @@ -10,7 +10,10 @@ def test_init_factory_basic(): """Tests py::init_factory() wrapper around various ways of returning the object""" - cstats = [ConstructorStats.get(c) for c in [m.TestFactory1, m.TestFactory2, m.TestFactory3]] + cstats = [ + ConstructorStats.get(c) + for c in [m.TestFactory1, m.TestFactory2, m.TestFactory3] + ] cstats[0].alive() # force gc n_inst = ConstructorStats.detail_reg_inst() @@ -42,7 +45,9 @@ def test_init_factory_basic(): for null_ptr_kind in [tag.null_ptr, tag.null_unique_ptr, tag.null_shared_ptr]: with pytest.raises(TypeError) as excinfo: m.TestFactory3(null_ptr_kind) - assert str(excinfo.value) == "pybind11::init(): factory function returned nullptr" + assert ( + str(excinfo.value) == "pybind11::init(): factory function returned nullptr" + ) assert [i.alive() for i in cstats] == [3, 3, 3] assert ConstructorStats.detail_reg_inst() == n_inst + 9 @@ -98,7 +103,10 @@ def test_init_factory_signature(msg): def test_init_factory_casting(): """Tests py::init_factory() wrapper with various upcasting and downcasting returns""" - cstats = [ConstructorStats.get(c) for c in [m.TestFactory3, m.TestFactory4, m.TestFactory5]] + cstats = [ + ConstructorStats.get(c) + for c in [m.TestFactory3, m.TestFactory4, m.TestFactory5] + ] cstats[0].alive() # force gc n_inst = ConstructorStats.detail_reg_inst() @@ -483,9 +491,13 @@ def __init__(self, bad): a = m.TestFactory2(tag.pointer, 1) m.TestFactory6.__init__(a, tag.alias, 1) elif bad == 3: - m.TestFactory6.__init__(NotPybindDerived.__new__(NotPybindDerived), tag.base, 1) + m.TestFactory6.__init__( + NotPybindDerived.__new__(NotPybindDerived), tag.base, 1 + ) elif bad == 4: - m.TestFactory6.__init__(NotPybindDerived.__new__(NotPybindDerived), tag.alias, 1) + m.TestFactory6.__init__( + NotPybindDerived.__new__(NotPybindDerived), tag.alias, 1 + ) for arg in (1, 2): with pytest.raises(TypeError) as excinfo: diff --git a/extern/pybind11/tests/test_gil_scoped.py b/extern/pybind11/tests/test_gil_scoped.py index a41f6dd5..6af6a472 100644 --- a/extern/pybind11/tests/test_gil_scoped.py +++ b/extern/pybind11/tests/test_gil_scoped.py @@ -160,7 +160,9 @@ def _run_in_process(target, *args, **kwargs): t_start = time.time() process.start() if timeout >= 100: # For debugging. - print("\nprocess.pid STARTED", process.pid, (sys.argv, target, args, kwargs)) + print( + "\nprocess.pid STARTED", process.pid, (sys.argv, target, args, kwargs) + ) print(f"COPY-PASTE-THIS: gdb {sys.argv[0]} -p {process.pid}", flush=True) process.join(timeout=timeout) if timeout >= 100: diff --git a/extern/pybind11/tests/test_kwargs_and_defaults.py b/extern/pybind11/tests/test_kwargs_and_defaults.py index 59d10d51..ab701788 100644 --- a/extern/pybind11/tests/test_kwargs_and_defaults.py +++ b/extern/pybind11/tests/test_kwargs_and_defaults.py @@ -12,13 +12,16 @@ def test_function_signatures(doc): assert doc(m.kw_func_udl) == "kw_func_udl(x: int, y: int = 300) -> str" assert doc(m.kw_func_udl_z) == "kw_func_udl_z(x: int, y: int = 0) -> str" assert doc(m.args_function) == "args_function(*args) -> tuple" - assert doc(m.args_kwargs_function) == "args_kwargs_function(*args, **kwargs) -> tuple" + assert ( + doc(m.args_kwargs_function) == "args_kwargs_function(*args, **kwargs) -> tuple" + ) assert ( doc(m.KWClass.foo0) == "foo0(self: m.kwargs_and_defaults.KWClass, arg0: int, arg1: float) -> None" ) assert ( - doc(m.KWClass.foo1) == "foo1(self: m.kwargs_and_defaults.KWClass, x: int, y: float) -> None" + doc(m.KWClass.foo1) + == "foo1(self: m.kwargs_and_defaults.KWClass, x: int, y: float) -> None" ) @@ -40,7 +43,8 @@ def test_named_arguments(msg): # noinspection PyArgumentList m.kw_func2(x=5, y=10, z=12) assert excinfo.match( - r"(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$))" + "{3}$" + r"(?s)^kw_func2\(\): incompatible.*Invoked with: kwargs: ((x=5|y=10|z=12)(, |$))" + + "{3}$" ) assert m.kw_func4() == "{13 17}" @@ -331,7 +335,10 @@ def test_signatures(): assert "kw_only_mixed(i: int, *, j: int) -> tuple\n" == m.kw_only_mixed.__doc__ assert "pos_only_all(i: int, j: int, /) -> tuple\n" == m.pos_only_all.__doc__ assert "pos_only_mix(i: int, /, j: int) -> tuple\n" == m.pos_only_mix.__doc__ - assert "pos_kw_only_mix(i: int, /, j: int, *, k: int) -> tuple\n" == m.pos_kw_only_mix.__doc__ + assert ( + "pos_kw_only_mix(i: int, /, j: int, *, k: int) -> tuple\n" + == m.pos_kw_only_mix.__doc__ + ) def test_args_refcount(): diff --git a/extern/pybind11/tests/test_local_bindings.py b/extern/pybind11/tests/test_local_bindings.py index 3591dadc..d6418773 100644 --- a/extern/pybind11/tests/test_local_bindings.py +++ b/extern/pybind11/tests/test_local_bindings.py @@ -53,7 +53,9 @@ def test_nonlocal_failure(): with pytest.raises(RuntimeError) as excinfo: cm.register_nonlocal() - assert str(excinfo.value) == 'generic_type: type "NonLocalType" is already registered!' + assert ( + str(excinfo.value) == 'generic_type: type "NonLocalType" is already registered!' + ) def test_duplicate_local(): @@ -108,15 +110,21 @@ def test_stl_bind_global(): with pytest.raises(RuntimeError) as excinfo: cm.register_nonlocal_map() - assert str(excinfo.value) == 'generic_type: type "NonLocalMap" is already registered!' + assert ( + str(excinfo.value) == 'generic_type: type "NonLocalMap" is already registered!' + ) with pytest.raises(RuntimeError) as excinfo: cm.register_nonlocal_vec() - assert str(excinfo.value) == 'generic_type: type "NonLocalVec" is already registered!' + assert ( + str(excinfo.value) == 'generic_type: type "NonLocalVec" is already registered!' + ) with pytest.raises(RuntimeError) as excinfo: cm.register_nonlocal_map2() - assert str(excinfo.value) == 'generic_type: type "NonLocalMap2" is already registered!' + assert ( + str(excinfo.value) == 'generic_type: type "NonLocalMap2" is already registered!' + ) def test_mixed_local_global(): diff --git a/extern/pybind11/tests/test_methods_and_attributes.py b/extern/pybind11/tests/test_methods_and_attributes.py index 49eb4285..0a2ae123 100644 --- a/extern/pybind11/tests/test_methods_and_attributes.py +++ b/extern/pybind11/tests/test_methods_and_attributes.py @@ -6,9 +6,15 @@ from pybind11_tests import ConstructorStats from pybind11_tests import methods_and_attributes as m -NO_GETTER_MSG = "unreadable attribute" if sys.version_info < (3, 11) else "object has no getter" -NO_SETTER_MSG = "can't set attribute" if sys.version_info < (3, 11) else "object has no setter" -NO_DELETER_MSG = "can't delete attribute" if sys.version_info < (3, 11) else "object has no deleter" +NO_GETTER_MSG = ( + "unreadable attribute" if sys.version_info < (3, 11) else "object has no getter" +) +NO_SETTER_MSG = ( + "can't set attribute" if sys.version_info < (3, 11) else "object has no setter" +) +NO_DELETER_MSG = ( + "can't delete attribute" if sys.version_info < (3, 11) else "object has no deleter" +) def test_methods_and_attributes(): @@ -179,7 +185,8 @@ def test_static_properties(): del m.TestPropertiesOverride.def_readonly_static assert ( hasattr(m.TestPropertiesOverride, "def_readonly_static") - and m.TestPropertiesOverride.def_readonly_static is m.TestProperties.def_readonly_static + and m.TestPropertiesOverride.def_readonly_static + is m.TestProperties.def_readonly_static ) assert "def_readonly_static" not in m.TestPropertiesOverride.__dict__ properties_override = m.TestPropertiesOverride() @@ -209,7 +216,10 @@ def test_metaclass_override(): assert type(m.MetaclassOverride).__name__ == "type" assert m.MetaclassOverride.readonly == 1 - assert type(m.MetaclassOverride.__dict__["readonly"]).__name__ == "pybind11_static_property" + assert ( + type(m.MetaclassOverride.__dict__["readonly"]).__name__ + == "pybind11_static_property" + ) # Regular `type` replaces the property instead of calling `__set__()` m.MetaclassOverride.readonly = 2 diff --git a/extern/pybind11/tests/test_modules.py b/extern/pybind11/tests/test_modules.py index 78b5eddd..c3e8cea6 100644 --- a/extern/pybind11/tests/test_modules.py +++ b/extern/pybind11/tests/test_modules.py @@ -11,7 +11,10 @@ def test_nested_modules(): assert pybind11_tests.__name__ == "pybind11_tests" assert pybind11_tests.modules.__name__ == "pybind11_tests.modules" - assert pybind11_tests.modules.subsubmodule.__name__ == "pybind11_tests.modules.subsubmodule" + assert ( + pybind11_tests.modules.subsubmodule.__name__ + == "pybind11_tests.modules.subsubmodule" + ) assert m.__name__ == "pybind11_tests.modules" assert ms.__name__ == "pybind11_tests.modules.subsubmodule" diff --git a/extern/pybind11/tests/test_numpy_array.py b/extern/pybind11/tests/test_numpy_array.py index 5b48888d..cdec9ad6 100644 --- a/extern/pybind11/tests/test_numpy_array.py +++ b/extern/pybind11/tests/test_numpy_array.py @@ -17,7 +17,9 @@ def test_dtypes(): print(check) assert check.numpy == check.pybind11, check if check.numpy.num != check.pybind11.num: - print(f"NOTE: typenum mismatch for {check}: {check.numpy.num} != {check.pybind11.num}") + print( + f"NOTE: typenum mismatch for {check}: {check.numpy.num} != {check.pybind11.num}" + ) @pytest.fixture(scope="function") @@ -64,7 +66,9 @@ def test_array_attributes(): assert not m.owndata(a) -@pytest.mark.parametrize("args, ret", [([], 0), ([0], 0), ([1], 3), ([0, 1], 1), ([1, 2], 5)]) +@pytest.mark.parametrize( + "args, ret", [([], 0), ([0], 0), ([1], 3), ([0, 1], 1), ([1, 2], 5)] +) def test_index_offset(arr, args, ret): assert m.index_at(arr, *args) == ret assert m.index_at_t(arr, *args) == ret @@ -382,7 +386,9 @@ def test_array_unchecked_fixed_dims(msg): with pytest.raises(ValueError) as excinfo: m.proxy_add2(np.array([1.0, 2, 3]), 5.0) - assert msg(excinfo.value) == "array has incorrect number of dimensions: 1; expected 2" + assert ( + msg(excinfo.value) == "array has incorrect number of dimensions: 1; expected 2" + ) expect_c = np.ndarray(shape=(3, 3, 3), buffer=np.array(range(3, 30)), dtype="int") assert np.all(m.proxy_init3(3.0) == expect_c) @@ -554,14 +560,18 @@ def test_argument_conversions(forcecast, contiguity, noconvert): # trivially contiguous. trivially_contiguous = sum(1 for d in shape if d > 1) <= 1 should_raise = dtype.name != "float64" or ( - contiguity is not None and contiguity != order and not trivially_contiguous + contiguity is not None + and contiguity != order + and not trivially_contiguous ) array = np.zeros(shape, dtype=dtype, order=order) if not should_raise: function(array) else: - with pytest.raises(TypeError, match="incompatible function arguments"): + with pytest.raises( + TypeError, match="incompatible function arguments" + ): function(array) diff --git a/extern/pybind11/tests/test_numpy_dtypes.py b/extern/pybind11/tests/test_numpy_dtypes.py index 93b488db..fcfd587b 100644 --- a/extern/pybind11/tests/test_numpy_dtypes.py +++ b/extern/pybind11/tests/test_numpy_dtypes.py @@ -52,7 +52,10 @@ def packed_dtype_fmt(): def partial_ld_offset(): return ( - 12 + 4 * (np.dtype("uint64").alignment > 4) + 8 + 8 * (np.dtype("longdouble").alignment > 8) + 12 + + 4 * (np.dtype("uint64").alignment > 4) + + 8 + + 8 * (np.dtype("longdouble").alignment > 8) ) @@ -61,7 +64,9 @@ def partial_dtype_fmt(): partial_ld_off = partial_ld_offset() partial_size = partial_ld_off + ld.itemsize partial_end_padding = partial_size % np.dtype("uint64").alignment - return dt_fmt().format(ld.itemsize, partial_ld_off, partial_size + partial_end_padding) + return dt_fmt().format( + ld.itemsize, partial_ld_off, partial_size + partial_end_padding + ) def partial_nested_fmt(): @@ -83,7 +88,9 @@ def assert_equal(actual, expected_data, expected_dtype): def test_format_descriptors(): with pytest.raises(RuntimeError) as excinfo: m.get_format_unbound() - assert re.match("^NumPy type info missing for .*UnboundStruct.*$", str(excinfo.value)) + assert re.match( + "^NumPy type info missing for .*UnboundStruct.*$", str(excinfo.value) + ) ld = np.dtype("longdouble") ldbl_fmt = ("4x" if ld.alignment > 4 else "") + ld.char @@ -165,7 +172,9 @@ def test_dtype(simple_dtype): simple_dtype.itemsize, ] - assert m.trailing_padding_dtype() == m.buffer_to_dtype(np.zeros(1, m.trailing_padding_dtype())) + assert m.trailing_padding_dtype() == m.buffer_to_dtype( + np.zeros(1, m.trailing_padding_dtype()) + ) expected_chars = "bhilqBHILQefdgFDG?MmO" assert m.test_dtype_kind() == list("iiiiiuuuuuffffcccbMmO") @@ -338,7 +347,10 @@ def test_complex_array(): def test_signature(doc): - assert doc(m.create_rec_nested) == "create_rec_nested(arg0: int) -> numpy.ndarray[NestedStruct]" + assert ( + doc(m.create_rec_nested) + == "create_rec_nested(arg0: int) -> numpy.ndarray[NestedStruct]" + ) def test_scalar_conversion(): diff --git a/extern/pybind11/tests/test_numpy_vectorize.py b/extern/pybind11/tests/test_numpy_vectorize.py index 5a996bad..7e8c015c 100644 --- a/extern/pybind11/tests/test_numpy_vectorize.py +++ b/extern/pybind11/tests/test_numpy_vectorize.py @@ -138,7 +138,10 @@ def test_vectorize(capture): def test_type_selection(): assert m.selective_func(np.array([1], dtype=np.int32)) == "Int branch taken." assert m.selective_func(np.array([1.0], dtype=np.float32)) == "Float branch taken." - assert m.selective_func(np.array([1.0j], dtype=np.complex64)) == "Complex float branch taken." + assert ( + m.selective_func(np.array([1.0j], dtype=np.complex64)) + == "Complex float branch taken." + ) def test_docs(doc): @@ -155,7 +158,10 @@ def test_trivial_broadcasting(): assert vectorized_is_trivial(1, 2, 3) == trivial.c_trivial assert vectorized_is_trivial(np.array(1), np.array(2), 3) == trivial.c_trivial - assert vectorized_is_trivial(np.array([1, 3]), np.array([2, 4]), 3) == trivial.c_trivial + assert ( + vectorized_is_trivial(np.array([1, 3]), np.array([2, 4]), 3) + == trivial.c_trivial + ) assert trivial.c_trivial == vectorized_is_trivial( np.array([[1, 3, 5], [7, 9, 11]]), np.array([[2, 4, 6], [8, 10, 12]]), 3 ) diff --git a/extern/pybind11/tests/test_pytypes.py b/extern/pybind11/tests/test_pytypes.py index 2778ad50..a1a80a29 100644 --- a/extern/pybind11/tests/test_pytypes.py +++ b/extern/pybind11/tests/test_pytypes.py @@ -451,7 +451,9 @@ def test_non_converting_constructors(): for move in [True, False]: with pytest.raises(TypeError) as excinfo: m.nonconverting_constructor(t, v, move) - expected_error = f"Object of type '{type(v).__name__}' is not an instance of '{t}'" + expected_error = ( + f"Object of type '{type(v).__name__}' is not an instance of '{t}'" + ) assert str(excinfo.value) == expected_error diff --git a/extern/pybind11/tests/test_smart_ptr.py b/extern/pybind11/tests/test_smart_ptr.py index 87a09479..2f204e01 100644 --- a/extern/pybind11/tests/test_smart_ptr.py +++ b/extern/pybind11/tests/test_smart_ptr.py @@ -6,7 +6,9 @@ def test_smart_ptr(capture): # Object1 - for i, o in enumerate([m.make_object_1(), m.make_object_2(), m.MyObject1(3)], start=1): + for i, o in enumerate( + [m.make_object_1(), m.make_object_2(), m.MyObject1(3)], start=1 + ): assert o.getRefCount() == 1 with capture: m.print_object_1(o) @@ -15,7 +17,9 @@ def test_smart_ptr(capture): m.print_object_4(o) assert capture == f"MyObject1[{i}]\n" * 4 - for i, o in enumerate([m.make_myobject1_1(), m.make_myobject1_2(), m.MyObject1(6), 7], start=4): + for i, o in enumerate( + [m.make_myobject1_1(), m.make_myobject1_2(), m.MyObject1(6), 7], start=4 + ): print(o) with capture: if not isinstance(o, int): @@ -42,7 +46,9 @@ def test_smart_ptr(capture): assert cstats.move_assignments == 0 # Object2 - for i, o in zip([8, 6, 7], [m.MyObject2(8), m.make_myobject2_1(), m.make_myobject2_2()]): + for i, o in zip( + [8, 6, 7], [m.MyObject2(8), m.make_myobject2_1(), m.make_myobject2_2()] + ): print(o) with capture: m.print_myobject2_1(o) @@ -63,7 +69,9 @@ def test_smart_ptr(capture): assert cstats.move_assignments == 0 # Object3 - for i, o in zip([9, 8, 9], [m.MyObject3(9), m.make_myobject3_1(), m.make_myobject3_2()]): + for i, o in zip( + [9, 8, 9], [m.MyObject3(9), m.make_myobject3_1(), m.make_myobject3_2()] + ): print(o) with capture: m.print_myobject3_1(o) @@ -194,7 +202,9 @@ def test_shared_ptr_from_this_and_references(): ref = s.ref # init_holder_helper(holder_ptr=false, owned=false, bad_wp=false) assert stats.alive() == 2 assert s.set_ref(ref) - assert s.set_holder(ref) # std::enable_shared_from_this can create a holder from a reference + assert s.set_holder( + ref + ) # std::enable_shared_from_this can create a holder from a reference bad_wp = s.bad_wp # init_holder_helper(holder_ptr=false, owned=false, bad_wp=true) assert stats.alive() == 2 @@ -208,12 +218,16 @@ def test_shared_ptr_from_this_and_references(): assert s.set_ref(copy) assert s.set_holder(copy) - holder_ref = s.holder_ref # init_holder_helper(holder_ptr=true, owned=false, bad_wp=false) + holder_ref = ( + s.holder_ref + ) # init_holder_helper(holder_ptr=true, owned=false, bad_wp=false) assert stats.alive() == 3 assert s.set_ref(holder_ref) assert s.set_holder(holder_ref) - holder_copy = s.holder_copy # init_holder_helper(holder_ptr=true, owned=true, bad_wp=false) + holder_copy = ( + s.holder_copy + ) # init_holder_helper(holder_ptr=true, owned=true, bad_wp=false) assert stats.alive() == 3 assert s.set_ref(holder_copy) assert s.set_holder(holder_copy) @@ -285,8 +299,9 @@ def test_smart_ptr_from_default(): instance = m.HeldByDefaultHolder() with pytest.raises(RuntimeError) as excinfo: m.HeldByDefaultHolder.load_shared_ptr(instance) - assert "Unable to load a custom holder type from a " "default-holder instance" in str( - excinfo.value + assert ( + "Unable to load a custom holder type from a " + "default-holder instance" in str(excinfo.value) ) diff --git a/extern/pybind11/tests/test_stl.py b/extern/pybind11/tests/test_stl.py index ecd3f556..d30c3821 100644 --- a/extern/pybind11/tests/test_stl.py +++ b/extern/pybind11/tests/test_stl.py @@ -140,7 +140,9 @@ def test_optional(): assert int(props.access_by_copy) == 42 -@pytest.mark.skipif(not hasattr(m, "has_exp_optional"), reason="no ") +@pytest.mark.skipif( + not hasattr(m, "has_exp_optional"), reason="no " +) def test_exp_optional(): assert m.double_or_zero_exp(None) == 0 assert m.double_or_zero_exp(42) == 84 @@ -260,10 +262,14 @@ def test_variant(doc): assert m.cast_variant() == (5, "Hello") - assert doc(m.load_variant) == "load_variant(arg0: Union[int, str, float, None]) -> str" + assert ( + doc(m.load_variant) == "load_variant(arg0: Union[int, str, float, None]) -> str" + ) -@pytest.mark.skipif(not hasattr(m, "load_monostate_variant"), reason="no std::monostate") +@pytest.mark.skipif( + not hasattr(m, "load_monostate_variant"), reason="no std::monostate" +) def test_variant_monostate(doc): assert m.load_monostate_variant(None) == "std::monostate" assert m.load_monostate_variant(1) == "int" diff --git a/extern/pybind11/tests/test_virtual_functions.py b/extern/pybind11/tests/test_virtual_functions.py index 2d4a829b..4d00d369 100644 --- a/extern/pybind11/tests/test_virtual_functions.py +++ b/extern/pybind11/tests/test_virtual_functions.py @@ -45,7 +45,10 @@ def get_string2(self): with pytest.raises(RuntimeError) as excinfo: m.runExampleVirtVirtual(ex12) - assert msg(excinfo.value) == 'Tried to call pure virtual function "ExampleVirt::pure_virtual"' + assert ( + msg(excinfo.value) + == 'Tried to call pure virtual function "ExampleVirt::pure_virtual"' + ) ex12p = ExtendedExampleVirt(10) with capture: @@ -242,7 +245,10 @@ class PyClass2(m.DispatchIssue): def dispatch(self): with pytest.raises(RuntimeError) as excinfo: super().dispatch() - assert msg(excinfo.value) == 'Tried to call pure virtual function "Base::dispatch"' + assert ( + msg(excinfo.value) + == 'Tried to call pure virtual function "Base::dispatch"' + ) return m.dispatch_issue_go(PyClass1()) diff --git a/extern/pybind11/tools/make_changelog.py b/extern/pybind11/tools/make_changelog.py index 28a76893..b5bd8329 100755 --- a/extern/pybind11/tools/make_changelog.py +++ b/extern/pybind11/tools/make_changelog.py @@ -24,7 +24,9 @@ api = ghapi.all.GhApi(owner="pybind", repo="pybind11") -issues_pages = ghapi.page.paged(api.issues.list_for_repo, labels="needs changelog", state="closed") +issues_pages = ghapi.page.paged( + api.issues.list_for_repo, labels="needs changelog", state="closed" +) issues = (issue for page in issues_pages for issue in page) missing = []