Chromium Code Reviews| Index: scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_test.py |
| diff --git a/scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_test.py b/scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_test.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..05e53a4e13b4ca8cf555608911c3d6290d338aab |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/auto_bisect/resources/significantly_different_test.py |
| @@ -0,0 +1,30 @@ |
| +#!/usr/bin/python |
|
dtu
2016/02/05 00:18:02
#!/usr/bin/env python
|
| +"""Tests for significantly_different.""" |
| + |
| +import os |
| +import unittest |
| + |
| +# pylint: disable=relative-import |
| +import significantly_different |
| + |
| + |
| +class SignificantlyDifferentTest(unittest.TestCase): |
| + |
| + def setUp(self): |
| + self.conda_path = None |
| + try: |
| + import scipy # pylint: disable=unused-variable |
| + self.conda_path = 'python' |
|
dtu
2016/02/05 00:18:02
sys.executable
|
| + except ImportError: |
| + if os.path.exists(os.path.expanduser('~/conda-test/bin/python')): |
| + self.conda_path = os.path.expanduser('~/conda-test/bin/python') |
| + |
| + def test_basic_case(self): |
| + results = significantly_different.main( |
| + ['', '[1, 2, 3, 3, 2, 1]', '[1, 2, 2, 2, 5, 0]', 0.05], self.conda_path) |
| + self.assertAlmostEqual( |
| + 0.40073980338363635, |
| + results['mann_p_value']) |
| + |
| +if __name__ == '__main__': |
| + unittest.main() |