Skip to content

Commit

Permalink
Merge pull request #6 from corriporai/develop
Browse files Browse the repository at this point in the history
CLN/MANT: support tox to black
  • Loading branch information
marcelcaraciolo authored Nov 1, 2020
2 parents e2dd008 + 37610fc commit 5cf58de
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 22 deletions.
10 changes: 4 additions & 6 deletions runpandas/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@


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:
return False


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)
Expand Down Expand Up @@ -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
----------
Expand Down Expand Up @@ -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
----------
Expand Down
3 changes: 1 addition & 2 deletions runpandas/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
91 changes: 78 additions & 13 deletions runpandas/tests/test_gpx_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
),
]


Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down

0 comments on commit 5cf58de

Please sign in to comment.