diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c5c58a1 --- /dev/null +++ b/.flake8 @@ -0,0 +1,4 @@ +[flake8] +per-file-ignores = + # line too long + tests/test_ibw.py: E501, diff --git a/tests/helper.py b/tests/helper.py index 1988194..4b08d5b 100644 --- a/tests/helper.py +++ b/tests/helper.py @@ -1,14 +1,16 @@ import pathlib import numpy as _numpy -from pprint import pformat, PrettyPrinter +from pprint import PrettyPrinter from igor2.binarywave import load as loadibw data_dir = pathlib.Path(__file__).parent / "data" + class NumpyPrettyPrinter(PrettyPrinter): def format(self, object, context, maxlevels, level): if isinstance(object, _numpy.ndarray): - # Generate the entire array string using numpy's own mechanism but ensuring dtype is displayed + # Generate the entire array string using numpy's own mechanism but + # ensuring dtype is displayed array_repr = _numpy.array2string(object, separator=', ') # Append dtype only once for the whole array formatted_array = f"array({array_repr}, dtype='{object.dtype}')" @@ -18,11 +20,11 @@ def format(self, object, context, maxlevels, level): def custom_pformat(object, indent=1, width=80, depth=None, *, compact=False): - printer = NumpyPrettyPrinter(indent=indent, width=width, depth=depth, compact=compact) + printer = NumpyPrettyPrinter( + indent=indent, width=width, depth=depth, compact=compact) return printer.pformat(object) - def assert_equal_dump_no_whitespace_no_byte(data_a, data_b): def repl(x): for old, new in [