Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moves tests on toplevel, partly removes jit from hymod_python.py #226 #232

Merged
merged 2 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ install:

script:
- pip uninstall spotpy -y
- py.test spotpy/tests/test_* --cov spotpy --cov-report term-missing -v
- mpirun -c 2 python spotpy/examples/dds/dds_parallel.py 10
- py.test tests/test_* --cov spotpy --cov-report term-missing -v
- mpirun -c 4 python spotpy/examples/dds/dds_parallel.py 100

after_success:
- coveralls
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules'],
)
4 changes: 1 addition & 3 deletions spotpy/examples/hymod_python/hymod.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from numba import jit

@jit

def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq):
"""
See https://www.proc-iahs.net/368/180/2015/piahs-368-180-2015.pdf for a scientific paper.
Expand All @@ -22,7 +22,6 @@ def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq):
# Initialize state(s) of quick tank(s)
x_quick = [0,0,0]
t = 0
outflow = []
output = []
# START PROGRAMMING LOOP WITH DETERMINING RAINFALL - RUNOFF AMOUNTS

Expand Down Expand Up @@ -50,7 +49,6 @@ def hymod(Precip, PET, cmax,bexp,alpha,Rs,Rq):
output.append(QS + outflow)
t = t+1


return output

@jit
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion spotpy/tests/test_fast.py → tests/test_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
sys.path.append(".")
import spotpy


from spotpy.examples.spot_setup_hymod_python import spot_setup

# Test only untder Python 3 as lower versions results in a strange fft error
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion spotpy/tests/test_padds.py → tests/test_padds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np

from spotpy.examples.tutorial_padds import padds_spot_setup
from spotpy.tests.test_dds import FixedRandomizer
from tests.test_dds import FixedRandomizer

try:
import spotpy
Expand Down
2 changes: 1 addition & 1 deletion spotpy/tests/test_parallel.py → tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setUpClass(self):
# How many digits to match in case of floating point answers
self.tolerance = 7
#Create samplers for every algorithm:
self.rep = 987
self.rep = 21
self.timeout = 10 #Given in Seconds

self.dbformat = "ram"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def test_create(self):
def test_assign(self):
values = [1] * len(self.ps)
self.ps(*values)
self.assertEquals(list(self.ps), values)
self.assertEqual(list(self.ps), values)
# Test if wrong number of parameters raises
with self.assertRaises(ValueError):
self.ps(*values[:-1])
Expand All @@ -119,13 +119,13 @@ def test_iter(self):
values = [1] * len(self.ps)
self.ps(*values)
ps_values = list(self.ps)
self.assertEquals(values, ps_values)
self.assertEqual(values, ps_values)

def test_getitem(self):
values = [1] * len(self.ps)
self.ps(*values)
self.assertEquals(self.ps['a'], 1.0)
self.assertEquals(self.ps[0], 1.0)
self.assertEqual(self.ps['a'], 1.0)
self.assertEqual(self.ps[0], 1.0)

def test_getattr(self):
values = [1] * len(self.ps)
Expand All @@ -134,15 +134,15 @@ def test_getattr(self):
with self.assertRaises(AttributeError):
_ = self.ps.__x

self.assertEquals(self.ps.a, 1.0)
self.assertEquals(list(self.ps.random), list(self.ps), 'Access to random variable does not equal list of names')
self.assertEqual(self.ps.a, 1.0)
self.assertEqual(list(self.ps.random), list(self.ps), 'Access to random variable does not equal list of names')

with self.assertRaises(AttributeError):
_ = self.ps.x

def test_setattr(self):
self.ps.a = 2
self.assertEquals(self.ps[0], 2)
self.assertEqual(self.ps[0], 2)

def test_dir(self):
values = [1] * len(self.ps)
Expand All @@ -157,12 +157,12 @@ def test_dir(self):
def test_str(self):
values = [1] * len(self.ps)
self.ps(*values)
self.assertEquals(str(self.ps), 'parameters(a=1, b=1, c=1, d=1)')
self.assertEqual(str(self.ps), 'parameters(a=1, b=1, c=1, d=1)')

def test_repr(self):
values = [1] * len(self.ps)
self.ps(*values)
self.assertEquals(repr(self.ps), 'spotpy.parameter.ParameterSet()')
self.assertEqual(repr(self.ps), 'spotpy.parameter.ParameterSet()')


class TestSetupVariants(unittest.TestCase):
Expand Down
2 changes: 0 additions & 2 deletions spotpy/tests/test_signatures.py → tests/test_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import spotpy

from spotpy.hydrology.signatures import SignatureMethod


import spotpy.hydrology as sig

class TestSignatures(unittest.TestCase):
Expand Down
File renamed without changes.