From 37610fc1c8291b00b7e802c43dcbc489a5471721 Mon Sep 17 00:00:00 2001 From: Marcel Caraciolo Date: Sat, 31 Oct 2020 23:42:16 -0300 Subject: [PATCH] CLN/MANT: support tox to black --- runpandas/_utils.py | 10 ++-- runpandas/reader.py | 3 +- runpandas/tests/test_gpx_reader.py | 91 +++++++++++++++++++++++++----- tox.ini | 7 ++- 4 files changed, 89 insertions(+), 22 deletions(-) diff --git a/runpandas/_utils.py b/runpandas/_utils.py index e16098e..0e69fbc 100644 --- a/runpandas/_utils.py +++ b/runpandas/_utils.py @@ -6,8 +6,7 @@ def file_exists(fname): - """Check if a file exists and is non-empty. - """ + """Check if a file exists and is non-empty.""" try: return fname and os.path.exists(fname) and os.path.getsize(fname) > 0 except OSError: @@ -15,8 +14,7 @@ def file_exists(fname): def splitext_plus(fname): - """Split on file extensions, allowing for zipped extensions. - """ + """Split on file extensions, allowing for zipped extensions.""" base, ext = os.path.splitext(fname) if ext in [".gz", ".bz2", ".zip"]: base, ext2 = os.path.splitext(base) @@ -62,7 +60,7 @@ def sans_ns(tag): def get_nodes(file_path, node_names, *, with_root=False): - """ Parse XML document and iterate over specific nodes + """Parse XML document and iterate over specific nodes Parameters ---------- @@ -90,7 +88,7 @@ def get_nodes(file_path, node_names, *, with_root=False): def camelcase_to_snakecase(string): - """ Converts the Camelcase string to snakecase string + """Converts the Camelcase string to snakecase string Example: ColumnName --> column_name Parameters ---------- diff --git a/runpandas/reader.py b/runpandas/reader.py index 5e46951..0560b53 100644 --- a/runpandas/reader.py +++ b/runpandas/reader.py @@ -40,8 +40,7 @@ def _read_file(filename, to_df=False, **kwargs): def _import_module(mod_name): - """ Find custom reading module to execute - """ + """Find custom reading module to execute""" mod = MODULE_CACHE.get(mod_name, None) if mod is None: try: diff --git a/runpandas/tests/test_gpx_reader.py b/runpandas/tests/test_gpx_reader.py index 231085f..3a558f7 100644 --- a/runpandas/tests/test_gpx_reader.py +++ b/runpandas/tests/test_gpx_reader.py @@ -29,23 +29,78 @@ def runpandas_activity(dirpath): test_data = [ - (pytest.lazy_fixture("pandas_activity"), "hr", 0, 120,), - (pytest.lazy_fixture("pandas_activity"), "hr", -1, 130,), - (pytest.lazy_fixture("pandas_activity"), "ele", 0, 23.6000003814697265625,), - (pytest.lazy_fixture("pandas_activity"), "ele", -1, 23.799999237060546875,), + ( + pytest.lazy_fixture("pandas_activity"), + "hr", + 0, + 120, + ), + ( + pytest.lazy_fixture("pandas_activity"), + "hr", + -1, + 130, + ), + ( + pytest.lazy_fixture("pandas_activity"), + "ele", + 0, + 23.6000003814697265625, + ), + ( + pytest.lazy_fixture("pandas_activity"), + "ele", + -1, + 23.799999237060546875, + ), ( pytest.lazy_fixture("pandas_activity"), "lat", 0, 51.43788929097354412078857421875, ), - (pytest.lazy_fixture("pandas_activity"), "lon", 0, 6.617012657225131988525390625,), - (pytest.lazy_fixture("pandas_activity"), "cad", -1, 80,), - (pytest.lazy_fixture("pandas_activity"), "cad", 0, 70,), - (pytest.lazy_fixture("runpandas_activity"), "hr", 0, 120,), - (pytest.lazy_fixture("runpandas_activity"), "hr", -1, 130,), - (pytest.lazy_fixture("runpandas_activity"), "alt", 0, 23.6000003814697265625,), - (pytest.lazy_fixture("runpandas_activity"), "alt", -1, 23.799999237060546875,), + ( + pytest.lazy_fixture("pandas_activity"), + "lon", + 0, + 6.617012657225131988525390625, + ), + ( + pytest.lazy_fixture("pandas_activity"), + "cad", + -1, + 80, + ), + ( + pytest.lazy_fixture("pandas_activity"), + "cad", + 0, + 70, + ), + ( + pytest.lazy_fixture("runpandas_activity"), + "hr", + 0, + 120, + ), + ( + pytest.lazy_fixture("runpandas_activity"), + "hr", + -1, + 130, + ), + ( + pytest.lazy_fixture("runpandas_activity"), + "alt", + 0, + 23.6000003814697265625, + ), + ( + pytest.lazy_fixture("runpandas_activity"), + "alt", + -1, + 23.799999237060546875, + ), ( pytest.lazy_fixture("runpandas_activity"), "lat", @@ -58,8 +113,18 @@ def runpandas_activity(dirpath): 0, 6.617012657225131988525390625, ), - (pytest.lazy_fixture("runpandas_activity"), "cad", -1, 80,), - (pytest.lazy_fixture("runpandas_activity"), "cad", 0, 70,), + ( + pytest.lazy_fixture("runpandas_activity"), + "cad", + -1, + 80, + ), + ( + pytest.lazy_fixture("runpandas_activity"), + "cad", + 0, + 70, + ), ] diff --git a/tox.ini b/tox.ini index 1c6b911..d128d25 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,16 @@ [tox] -envlist = py36, py37, py38, coverage, flake8 +envlist = py36, py37, py38, coverage, flake8, black [testenv:flake8] basepython = python deps = flake8 commands = flake8 runpandas/ +[testenv:black] +basepython = python +deps = black +commands = black --check runpandas + [testenv:coverage] basepython = python deps =