From 7f1293f7100d47824c12281238ce42aeef69167c Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 26 Aug 2019 17:38:16 -0700 Subject: MAINT: Avoid all BytesWarning A BytesWarning can be emitted when bytes are and strings are mismatched. Catching BytesWarning ensures a better boundary between str and bytes type. The test suite is now run with the -b flag to emit this warning. Fixes #9308 --- numpy/lib/tests/test_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/tests/test_io.py') diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py index 6ee17c830..1181fe986 100644 --- a/numpy/lib/tests/test_io.py +++ b/numpy/lib/tests/test_io.py @@ -1871,7 +1871,7 @@ M 33 21.99 data = ["1, 1, 1, 1, -1.1"] * 50 mdata = TextIO("\n".join(data)) - converters = {4: lambda x: "(%s)" % x} + converters = {4: lambda x: "(%s)" % x.decode()} kwargs = dict(delimiter=",", converters=converters, dtype=[(_, int) for _ in 'abcde'],) assert_raises(ValueError, np.genfromtxt, mdata, **kwargs) -- cgit v1.2.1