Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 32 lines (25 sloc) 1.113 kb
9252f1c @peterjc No code changes. Removing white space before ':' character to match P…
peterjc authored
1 # This code is part of the Biopython distribution and governed by its
2 # license. Please see the LICENSE file that should have been included
3 # as part of this package.
4
5 try:
2e03b52 @peterjc Skip test_lowess.py on PyPy (no numpy.median)
peterjc authored
6 from numpy import array, median
9252f1c @peterjc No code changes. Removing white space before ':' character to match P…
peterjc authored
7 except ImportError:
a225cf3 @peterjc Skip test if missing numpy (Bug 2672, see also Bug 2534)
peterjc authored
8 from Bio import MissingExternalDependencyError
cb1f544 @peterjc Use ImportError subclass for missing Python dependencies (see Gentoo …
peterjc authored
9 raise MissingExternalDependencyError(
a225cf3 @peterjc Skip test if missing numpy (Bug 2672, see also Bug 2534)
peterjc authored
10 "Install NumPy if you want to use Bio.Statistics.lowess.")
11
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
12 from Bio.Statistics.lowess import lowess
a38f847 Don't rely on a run_tests function; run print-and-compare tests autom…
mdehoon authored
13 import unittest
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
14
fd82a0a @cbrueffer Add blank lines where needed (PEP8 E302).
cbrueffer authored
15
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
16 class test_lowess(unittest.TestCase):
17
18 def test_Precomputed(self):
19 x = array([0.0, 1.0, 2.0, 3.0, 5.0, 9.0, 11.0])
a87df70 @peterjc PEP8 white space in Tests
peterjc authored
20 y = x ** 2
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
21 # Precalculated smooth output
22 ys = array([-2.96219015, 1.72680044, 6.58686813,
65d5d63 @carlosp420 PEP8 fixes, various test files
carlosp420 authored
23 11.62986671, 28.18598762, 86.85271581, 116.83893423])
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
24 # Smooth output calculated by the lowess function
a87df70 @peterjc PEP8 white space in Tests
peterjc authored
25 output = lowess(x, y, f=2. / 3., iter=3)
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
26 for precomputed, calculated in zip(ys, output):
ae0845c @tiagoantao very simple numpy example conversion - lowess
tiagoantao authored
27 self.assertAlmostEqual(precomputed, calculated, places=4)
c39899f Adding a test case for Bio.Statistics.lowess; see bug #2657.
mdehoon authored
28
29 if __name__ == "__main__":
b67cebf @peterjc Fix common PEP8 violation in unittest verbosity argument
peterjc authored
30 runner = unittest.TextTestRunner(verbosity=2)
a38f847 Don't rely on a run_tests function; run print-and-compare tests autom…
mdehoon authored
31 unittest.main(testRunner=runner)
Something went wrong with that request. Please try again.