-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from sertansenturk/ported_code_refactor
Ported code refactor
- Loading branch information
Showing
65 changed files
with
1,369 additions
and
5,358 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
# we only need to point to python for the tests to run | ||
language: python | ||
python: | ||
- "2.7" | ||
# - "3.3" | ||
# - "3.4" | ||
# - "3.5" | ||
|
||
# command to install dependencies | ||
matrix: | ||
include: | ||
# - name: "Docker build" | ||
# services: docker | ||
# python: 3.7 | ||
# env: TOX_ENV=docker | ||
# before_install: | ||
# - docker --version | ||
# - pip install -U pip | ||
# - pip install tox-travis | ||
# install: # installed by tox | ||
# script: tox -e $TOX_ENV | ||
# after_success: # do nothing | ||
- name: "Python 3.5" | ||
python: 3.5 | ||
env: TOX_PYTHON_ENV=py35 | ||
- name: "Python 3.6" | ||
python: 3.6 | ||
env: TOX_PYTHON_ENV=py36 | ||
- name: "Python 3.7" | ||
python: 3.7 | ||
env: TOX_PYTHON_ENV=py37 | ||
- name: "Python 3.8" | ||
python: 3.8 | ||
env: TOX_PYTHON_ENV=py38 | ||
before_install: | ||
- ls -la | ||
- pip install -U pip | ||
- pip install tox-travis | ||
- pip install codecov | ||
install: | ||
# - pip install -r requirements.txt | ||
- pip install flake8 | ||
|
||
# command to run before the tests | ||
before_script: | ||
- "flake8 tomato" | ||
|
||
# command to run tests | ||
- python setup.py install | ||
# - pip install . # install package | ||
# - pip install -r requirements.txt | ||
- pip show tomato | ||
script: | ||
# - nosetests unittests | ||
- nosetests --with-coverage | ||
- tox -e $TOX_PYTHON_ENV,flake8 #,pylint | ||
after_success: | ||
- codecov # submit coverage to https://codecov.io/gh/sertansenturk/tomato/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import numpy as np | ||
import pytest | ||
|
||
from tomato.converter import Converter | ||
|
||
|
||
def test_hz_to_cent_negative_hz_track(): | ||
# GIVEN | ||
hz_track = np.array([-50]) | ||
ref_freq = np.float(25.0) | ||
|
||
# WHEN; THEN | ||
with pytest.raises(ValueError): | ||
Converter.hz_to_cent(hz_track, ref_freq) | ||
|
||
|
||
def test_hz_to_cent_negative_ref_freq(): | ||
# GIVEN | ||
hz_track = np.array([50]) | ||
ref_freq = np.float(-5.0) | ||
|
||
# WHEN; THEN | ||
with pytest.raises(ValueError): | ||
Converter.hz_to_cent(hz_track, ref_freq) | ||
|
||
|
||
def test_hz_to_cent_negative_min_freq(): | ||
# GIVEN | ||
hz_track = np.array([50]) | ||
ref_freq = np.float(25.0) | ||
min_freq = -5.0 | ||
|
||
# WHEN; THEN | ||
with pytest.raises(ValueError): | ||
Converter.hz_to_cent(hz_track, ref_freq, min_freq) | ||
|
||
|
||
def test_hz_to_cent_ref_less_than_min(): | ||
# GIVEN | ||
hz_track = np.array([50]) | ||
ref_freq = np.float(25.0) | ||
min_freq = np.float(30.0) | ||
|
||
# WHEN; THEN | ||
with pytest.raises(ValueError): | ||
Converter.hz_to_cent(hz_track, ref_freq, min_freq) | ||
|
||
|
||
def test_hz_to_cent_hz_less_than_min(): | ||
# GIVEN | ||
hz_track = np.array([20]) | ||
ref_freq = np.float(35.0) | ||
min_freq = np.float(30.0) | ||
|
||
# WHEN | ||
result = Converter.hz_to_cent(hz_track, ref_freq, min_freq) | ||
|
||
# THEN | ||
expected = np.array([np.nan]) | ||
np.testing.assert_array_equal(result, expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# coding=utf-8 | ||
__version__ = '0.12.3' | ||
__version__ = '0.13.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.