diff --git a/.travis.yml b/.travis.yml index ef49d9f7b6fea..cb8376a9f5761 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: python env: global: # scatterci API key - - secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ=" + #- secure: "Bx5umgo6WjuGY+5XFa004xjCiX/vq0CyMZ/ETzcs7EIBI1BE/0fIDXOoWhoxbY9HPfdPGlDnDgB9nGqr5wArO2s+BavyKBWg6osZ3dmkfuJPMOWeyCa92EeP+sfKw8e5HSU5MizW9e319wHWOF/xkzdHR7T67Qd5erhv91x4DnQ=" # ironcache API key - secure: "e4eEFn9nDQc3Xa5BWYkzfX37jaWVq89XidVX+rcCNEr5OlOImvveeXnF1IzbRXznH4Sv0YsLwUd8RGUWOmyCvkONq/VJeqCHWtTMyfaCIdqSyhIP9Odz8r9ahch+Y0XFepBey92AJHmlnTh+2GjCDgIiqq4fzglojnp56Vg1ojA=" - secure: "CjmYmY5qEu3KrvMtel6zWFEtMq8ORBeS1S1odJHnjQpbwT1KY2YFZRVlLphfyDQXSz6svKUdeRrCNp65baBzs3DQNA8lIuXGIBYFeJxqVGtYAZZs6+TzBPfJJK798sGOj5RshrOJkFG2rdlWNuTq/XphI0JOrN3nPUkRrdQRpAw=" @@ -51,6 +51,7 @@ matrix: - JOB_NAME: "27_numpy_master" - JOB_TAG=_NUMPY_DEV_master - NUMPY_BUILD=master + - PANDAS_TESTING_MODE="numpy_deprecate" allow_failures: - python: 2.7 env: @@ -58,6 +59,7 @@ matrix: - JOB_NAME: "27_numpy_master" - JOB_TAG=_NUMPY_DEV_master - NUMPY_BUILD=master + - PANDAS_TESTING_MODE="numpy_deprecate" # allow importing from site-packages, # so apt-get python-x works for system pythons diff --git a/ci/after_script.sh b/ci/after_script.sh index 1c145062b69ec..b17d69daa5b8d 100755 --- a/ci/after_script.sh +++ b/ci/after_script.sh @@ -1,7 +1,7 @@ #!/bin/bash -wget https://raw.github.com/y-p/ScatterCI-CLI/master/scatter_cli.py -chmod u+x scatter_cli.py +#wget https://raw.github.com/y-p/ScatterCI-CLI/master/scatter_cli.py +#chmod u+x scatter_cli.py pip install -I requests==2.1.0 echo "${TRAVIS_PYTHON_VERSION:0:4}" @@ -12,7 +12,6 @@ fi # ScatterCI accepts a build log, but currently does nothing with it. echo '' > /tmp/build.log -# These should be in the environment, but not in source control # nore exposed in the build logs #export SCATTERCI_ACCESS_KEY= #export SCATTERCI_HOST= @@ -22,6 +21,6 @@ ci/print_versions.py -j /tmp/env.json # nose ran using "--with-xunit --xunit-file nosetest.xml" and generated /tmp/nosetest.xml # Will timeout if server not available, and should not fail the build -python scatter_cli.py --xunit-file /tmp/nosetests.xml --log-file /tmp/build.log --env-file /tmp/env.json --build-name "$JOB_NAME" --succeed +#python scatter_cli.py --xunit-file /tmp/nosetests.xml --log-file /tmp/build.log --env-file /tmp/env.json --build-name "$JOB_NAME" --succeed true # never fail because bad things happened here diff --git a/ci/script.sh b/ci/script.sh index e76789b689c94..152a2f1ebdcf9 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -16,13 +16,6 @@ fi "$TRAVIS_BUILD_DIR"/ci/build_docs.sh 2>&1 > /tmp/doc.log & # doc build log will be shown after tests -# export the testing mode -if [ -n "$NUMPY_BUILD" ]; then - - export PANDAS_TESTING_MODE="numpy_deprecate" - -fi - echo nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml nosetests --exe -w /tmp -A "$NOSE_ARGS" pandas --with-xunit --xunit-file=/tmp/nosetests.xml diff --git a/pandas/src/testing.pyx b/pandas/src/testing.pyx index 290226e1daf6a..bff070421c841 100644 --- a/pandas/src/testing.pyx +++ b/pandas/src/testing.pyx @@ -118,10 +118,7 @@ cpdef assert_almost_equal(a, b, bint check_less_precise=False): # deal with differing dtypes if check_less_precise: - dtype_a = np.dtype(type(a)) - dtype_b = np.dtype(type(b)) - if dtype_a.kind == 'f' and dtype_b == 'f': - decimal = 3 + decimal = 3 if np.isinf(a): assert np.isinf(b), "First object is inf, second isn't" @@ -132,11 +129,11 @@ cpdef assert_almost_equal(a, b, bint check_less_precise=False): if abs(fa) < 1e-5: if not decimal_almost_equal(fa, fb, decimal): assert False, ( - '(very low values) expected %.5f but got %.5f' % (b, a) + '(very low values) expected %.5f but got %.5f, with decimal %d' % (fb, fa, decimal) ) else: if not decimal_almost_equal(1, fb / fa, decimal): - assert False, 'expected %.5f but got %.5f' % (b, a) + assert False, 'expected %.5f but got %.5f, with decimal %d' % (fb, fa, decimal) else: assert a == b, "%r != %r" % (a, b) diff --git a/pandas/tests/test_testing.py b/pandas/tests/test_testing.py index 986e44ced83a2..298fa73c69064 100644 --- a/pandas/tests/test_testing.py +++ b/pandas/tests/test_testing.py @@ -154,6 +154,25 @@ def test_not_equal(self): # ATM meta data is not checked in assert_series_equal # self._assert_not_equal(Series(range(3)),Series(range(3),name='foo'),check_names=True) + def test_less_precise(self): + s1 = Series([0.12345],dtype='float64') + s2 = Series([0.12346],dtype='float64') + + self.assertRaises(AssertionError, assert_series_equal, s1, s2) + self._assert_equal(s1,s2,check_less_precise=True) + + s1 = Series([0.12345],dtype='float32') + s2 = Series([0.12346],dtype='float32') + + self.assertRaises(AssertionError, assert_series_equal, s1, s2) + self._assert_equal(s1,s2,check_less_precise=True) + + # even less than less precise + s1 = Series([0.1235],dtype='float32') + s2 = Series([0.1236],dtype='float32') + + self.assertRaises(AssertionError, assert_series_equal, s1, s2) + self.assertRaises(AssertionError, assert_series_equal, s1, s2, True) class TestRNGContext(unittest.TestCase):