Skip to content

Commit

Permalink
fixed test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Mar 3, 2020
1 parent 8cebf54 commit d62ef75
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Expand Up @@ -10,6 +10,14 @@ omit =
source =
python_utils
[report]
fail_under = 100
exclude_lines =
pragma: no cover
@abc.abstractmethod
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
10 changes: 6 additions & 4 deletions .travis.yml
Expand Up @@ -19,11 +19,11 @@ matrix:
env: TOXENV=py35
- python: '3.6'
env: TOXENV=py36
- python: '3.6'
- python: '3.7'
env: TOXENV=py37
- python: '3.6'
- python: '3.8'
env: TOXENV=py38
- python: '3.6'
- python: '3.9-dev'
env: TOXENV=py39
- python: 'pypy'
env: TOXENV=pypy
Expand All @@ -37,13 +37,15 @@ install:
- mkdir -p $PIP_WHEEL_DIR
- pip wheel -r tests/requirements.txt
- pip install -e .
- pip install tox coveralls
- pip install tox

script:
- tox

after_success:
- pip install codecov coveralls
- coveralls
- codecov

notifications:
email:
Expand Down
6 changes: 6 additions & 0 deletions python_utils/converters.py
Expand Up @@ -255,6 +255,12 @@ def remap(value, old_min, old_max, new_min, new_max):
>>> remap(46.0, 0.0, 100.0, -80.0, 10.0)
-38.6
Some edge cases to test
>>> remap(0, 0, 0, 0, 0)
0
>>> remap(0, 0, 0, 1, 0)
1
:param value: value to be converted
:type value: int, float
Expand Down
4 changes: 2 additions & 2 deletions python_utils/time.py
Expand Up @@ -71,9 +71,9 @@ def format_time(timestamp, precision=datetime.timedelta(seconds=1)):
seconds = seconds - (seconds % precision_seconds)

return str(datetime.timedelta(seconds=seconds))
elif isinstance(timestamp, datetime.datetime):
elif isinstance(timestamp, datetime.datetime): # pragma: no cover
# Python 2 doesn't have the timestamp method
if hasattr(timestamp, 'timestamp'): # pragma: no cover
if hasattr(timestamp, 'timestamp'):
seconds = timestamp.timestamp()
else:
seconds = timedelta_to_seconds(timestamp - epoch)
Expand Down

0 comments on commit d62ef75

Please sign in to comment.