Created
November 25, 2015 15:36
-
-
Save bsipocz/0f37ec40b7c929044fee to your computer and use it in GitHub Desktop.
PR4349 python3.4
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
(astropy-dev)bsipocz@tegla2:~/munka/devel/astropy$ python3 -c 'import astropy; astropy.test(remote_data=True); astropy.test(remote_data=True)' | |
============================= test session starts ============================== | |
platform darwin -- Python 3.4.3, pytest-2.8.3, py-1.4.30, pluggy-0.3.1 | |
Running tests with Astropy version 1.1.dev14144. | |
Running tests in astropy. | |
Date: 2015-11-25T14:56:51 | |
Platform: Darwin-14.5.0-x86_64-i386-64bit | |
Executable: /Users/bsipocz/.virtualenvs/astropy-dev/bin/python3 | |
Full Python Version: | |
3.4.3 (default, Feb 26 2015, 11:16:38) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] | |
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8 | |
byteorder: little | |
float info: dig: 15, mant_dig: 15 | |
Numpy: 1.10.1 | |
Scipy: 0.16.0 | |
Matplotlib: 1.5.0 | |
h5py: not available | |
Using Astropy options: remote_data. | |
rootdir: /Users/bsipocz/munka/devel/astropy, inifile: setup.cfg | |
collected 7426 items / 2 errors | |
astropy/_erfa/tests/test_erfa.py ..... | |
astropy/analytic_functions/tests/test_blackbody.py ..... | |
astropy/config/configuration.py . | |
astropy/config/tests/test_configs.py ................. | |
astropy/constants/__init__.py . | |
astropy/constants/tests/test_constant.py ........ | |
astropy/constants/tests/test_pickle.py xxxxxxxxx | |
astropy/convolution/kernels.py ... | |
astropy/convolution/tests/test_convolve.py ............................................................................................................... | |
astropy/convolution/tests/test_convolve_fft.py ................................................................................................................................................................................................................................................................................................................................................... | |
astropy/convolution/tests/test_convolve_kernels.py .............................................................................. | |
astropy/convolution/tests/test_discretize.py ...s...........s............... | |
astropy/convolution/tests/test_kernel_class.py ........................................................................................................................................................................................ | |
astropy/convolution/tests/test_pickle.py .xx.xx.xx | |
astropy/coordinates/angles.py .. | |
astropy/coordinates/baseframe.py . | |
astropy/coordinates/sky_coordinate.py .. | |
astropy/coordinates/builtin_frames/galactocentric.py . | |
astropy/coordinates/tests/test_angles.py ........................................ | |
astropy/coordinates/tests/test_angular_separation.py .... | |
astropy/coordinates/tests/test_api_ape5.py ..... | |
astropy/coordinates/tests/test_arrays.py ............. | |
astropy/coordinates/tests/test_celestial_transformations.py .......... | |
astropy/coordinates/tests/test_distance.py ......... | |
astropy/coordinates/tests/test_earth.py ............. | |
astropy/coordinates/tests/test_formatting.py .......... | |
astropy/coordinates/tests/test_frames.py ........................ | |
astropy/coordinates/tests/test_funcs.py ... | |
astropy/coordinates/tests/test_iau_fullstack.py .................................................... | |
astropy/coordinates/tests/test_intermediate_transformations.py ................................................... | |
astropy/coordinates/tests/test_matching.py ...... | |
astropy/coordinates/tests/test_name_resolve.py F.. | |
astropy/coordinates/tests/test_pickle.py ....xx.x...xx.x...xx.x. | |
astropy/coordinates/tests/test_regression.py ....... | |
astropy/coordinates/tests/test_representation.py ............................................................................. | |
astropy/coordinates/tests/test_sites.py ....... | |
astropy/coordinates/tests/test_sky_coord.py ........................................................................................................................................................................................................................................................................................................................................................................................x................. | |
astropy/coordinates/tests/test_transformations.py ...... | |
astropy/coordinates/tests/test_unit_representation.py . | |
astropy/coordinates/tests/accuracy/test_altaz_icrs.py ...x | |
astropy/coordinates/tests/accuracy/test_ecliptic.py ... | |
astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.py . | |
astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py . | |
astropy/coordinates/tests/accuracy/test_galactic_fk4.py . | |
astropy/coordinates/tests/accuracy/test_icrs_fk5.py . | |
astropy/cosmology/tests/test_cosmology.py ..................................... | |
astropy/cosmology/tests/test_pickle.py ... | |
astropy/io/ascii/daophot.py . | |
astropy/io/ascii/ipac.py . | |
astropy/io/ascii/tests/test_c_reader.py ...........................x..................x.......x.x................. | |
astropy/io/ascii/tests/test_cds_header_from_readme.py ... | |
astropy/io/ascii/tests/test_compressed.py ....... | |
astropy/io/ascii/tests/test_connect.py ........................ | |
astropy/io/ascii/tests/test_ecsv.py ....... | |
astropy/io/ascii/tests/test_fixedwidth.py ............................... | |
astropy/io/ascii/tests/test_html.py ........s....... | |
astropy/io/ascii/tests/test_ipac_definitions.py .................... | |
astropy/io/ascii/tests/test_read.py ......................................................................................................... | |
astropy/io/ascii/tests/test_types.py ... | |
astropy/io/ascii/tests/test_write.py ............... | |
astropy/io/fits/diff.py . | |
astropy/io/fits/util.py .. | |
astropy/io/fits/tests/test_checksum.py ..................... | |
astropy/io/fits/tests/test_connect.py .......................... | |
astropy/io/fits/tests/test_core.py .................................................ss.......... | |
astropy/io/fits/tests/test_diff.py ................................... | |
astropy/io/fits/tests/test_division.py ..... | |
astropy/io/fits/tests/test_groups.py ........ | |
astropy/io/fits/tests/test_hdulist.py ......................................... | |
astropy/io/fits/tests/test_header.py ................................................................................................................................................ | |
astropy/io/fits/tests/test_image.py ...................................................... | |
astropy/io/fits/tests/test_nonstandard.py ... | |
astropy/io/fits/tests/test_structured.py . | |
astropy/io/fits/tests/test_table.py .................................x..................................... | |
astropy/io/fits/tests/test_uint.py ........ | |
astropy/io/fits/tests/test_util.py . | |
astropy/io/misc/tests/test_hdf5.py sssssssssssssssssssssssssssssssssssssssss | |
astropy/io/misc/tests/test_pickle_helpers.py .... | |
astropy/io/tests/test_registry.py .............................. | |
astropy/io/votable/tests/converter_test.py ...................... | |
astropy/io/votable/tests/exception_test.py .. | |
astropy/io/votable/tests/table_test.py ........ | |
astropy/io/votable/tests/tree_test.py ... | |
astropy/io/votable/tests/ucd_test.py ..... | |
astropy/io/votable/tests/util_test.py ........... | |
astropy/io/votable/tests/vo_test.py ......................................................................................................................................................................... | |
astropy/modeling/_compound_deprecated.py .. | |
astropy/modeling/core.py ..s.. | |
astropy/modeling/functional_models.py . | |
astropy/modeling/mappings.py .. | |
astropy/modeling/parameters.py . | |
astropy/modeling/utils.py .. | |
astropy/modeling/tests/test_compound.py ....................................................s | |
astropy/modeling/tests/test_constraints.py ..................... | |
astropy/modeling/tests/test_core.py ............. | |
astropy/modeling/tests/test_fitters.py ................... | |
astropy/modeling/tests/test_functional_models.py ........... | |
astropy/modeling/tests/test_input.py ...................................................... | |
astropy/modeling/tests/test_mappings.py ...... | |
astropy/modeling/tests/test_models.py .............................................sss.s.sssss.ssss....................ss.s....s.........................sss.s..s..s...........sssss.s.sss.... | |
astropy/modeling/tests/test_parameters.py .................................................... | |
astropy/modeling/tests/test_polynomial.py ............................s......... | |
astropy/modeling/tests/test_projections.py ....................................................................................... | |
astropy/modeling/tests/test_rotations.py ............. | |
astropy/modeling/tests/test_utils.py ... | |
astropy/nddata/utils.py ...... | |
astropy/nddata/mixins/tests/test_ndarithmetic.py ........................................................ | |
astropy/nddata/mixins/tests/test_ndio.py . | |
astropy/nddata/tests/test_compat.py ................ | |
astropy/nddata/tests/test_decorators.py .......... | |
astropy/nddata/tests/test_flag_collection.py .......... | |
astropy/nddata/tests/test_nddata.py .................................. | |
astropy/nddata/tests/test_nddata_base.py . | |
astropy/nddata/tests/test_utils.py ..................................................... | |
astropy/stats/bayesian_blocks.py . | |
astropy/stats/funcs.py ..... | |
astropy/stats/sigma_clipping.py .. | |
astropy/stats/tests/test_bayesian_blocks.py ....... | |
astropy/stats/tests/test_funcs.py .................................. | |
astropy/stats/tests/test_histogram.py ......... | |
astropy/stats/tests/test_sigma_clipping.py ..... | |
astropy/table/info.py .. | |
astropy/table/meta.py s. | |
astropy/table/np_utils.py .. | |
astropy/table/operations.py .. | |
astropy/table/row.py . | |
astropy/table/table.py ............. | |
astropy/table/table_helpers.py . | |
astropy/table/tests/test_array.py ... | |
astropy/table/tests/test_bst.py ....... | |
astropy/table/tests/test_column.py ................................................................................... | |
astropy/table/tests/test_groups.py ...................................... | |
astropy/table/tests/test_index.py ................................................................................................................................................................................................................................................................................................................................................................................................................................................ | |
astropy/table/tests/test_info.py ............ | |
astropy/table/tests/test_init_table.py ................................................................................................................................................... | |
astropy/table/tests/test_item_access.py .............................. | |
astropy/table/tests/test_jsviewer.py ... | |
astropy/table/tests/test_masked.py .................................. | |
astropy/table/tests/test_mixin.py ..............................................................x.... | |
astropy/table/tests/test_np_utils.py . | |
astropy/table/tests/test_operations.py ...................................... | |
astropy/table/tests/test_pickle.py ............... | |
astropy/table/tests/test_pprint.py ........................................................ | |
astropy/table/tests/test_row.py .................................. | |
astropy/table/tests/test_subclass.py .. | |
astropy/table/tests/test_table.py ................................................................................................................................................................................................................................................................................................x........................................ | |
astropy/tests/test_logger.py ............................. | |
astropy/tests/tests/test_imports.py .. | |
astropy/tests/tests/test_open_file_detection.py . | |
astropy/tests/tests/test_quantity_helpers.py . | |
astropy/tests/tests/test_run_tests.py .... | |
astropy/tests/tests/test_skip_remote_data.py . | |
astropy/tests/tests/test_socketblocker.py .... | |
astropy/time/core.py .... | |
astropy/time/formats.py .. | |
astropy/time/tests/test_basic.py ....................................................... | |
astropy/time/tests/test_comparisons.py ... | |
astropy/time/tests/test_delta.py ................................................................................. | |
astropy/time/tests/test_guess.py .... | |
astropy/time/tests/test_methods.py ............................................... | |
astropy/time/tests/test_pickle.py . | |
astropy/time/tests/test_precision.py .......x.. | |
astropy/time/tests/test_quantity_interaction.py ............... | |
astropy/time/tests/test_sidereal.py ................... | |
astropy/time/tests/test_ut1.py ...s | |
astropy/units/cds.py . | |
astropy/units/core.py .... | |
astropy/units/equivalencies.py .... | |
astropy/units/imperial.py . | |
astropy/units/format/console.py . | |
astropy/units/format/unicode_format.py . | |
astropy/units/function/logarithmic.py . | |
astropy/units/tests/test_equivalencies.py ..................................................... | |
astropy/units/tests/test_format.py ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. | |
astropy/units/tests/test_logarithmic.py ............................................................................................................................................................................... | |
astropy/units/tests/test_physical.py ........... | |
astropy/units/tests/test_quantity.py ...................................................................... | |
astropy/units/tests/test_quantity_array_methods.py .............................x............x.x............. | |
astropy/units/tests/test_quantity_decorator.py ............................ | |
astropy/units/tests/test_quantity_non_ufuncs.py xx | |
astropy/units/tests/test_quantity_ufuncs.py .......................................................................................................................................................... | |
astropy/units/tests/test_units.py ............................................................................................................................................................................................................................................................................................................................................................................................................................................ | |
astropy/utils/data.py .... | |
astropy/utils/data_info.py .. | |
astropy/utils/decorators.py ... | |
astropy/utils/introspection.py ... | |
astropy/utils/misc.py ... | |
astropy/utils/timer.py . | |
astropy/utils/iers/iers.py . | |
astropy/utils/iers/tests/test_iers.py ....s | |
astropy/utils/tests/test_codegen.py . | |
astropy/utils/tests/test_collections.py ..... | |
astropy/utils/tests/test_compat.py . | |
astropy/utils/tests/test_console.py .......s................. | |
astropy/utils/tests/test_data.py .......................... | |
astropy/utils/tests/test_data_info.py ............. | |
astropy/utils/tests/test_decorators.py ........s.. | |
astropy/utils/tests/test_gzip.py .. | |
astropy/utils/tests/test_introspection.py .... | |
astropy/utils/tests/test_metadata.py ............... | |
astropy/utils/tests/test_misc.py ..... | |
astropy/utils/tests/test_odict.py sssssssssssssssssssssssssssssssssssssssssss | |
astropy/utils/tests/test_state.py .. | |
astropy/utils/tests/test_timer.py . | |
astropy/utils/tests/test_xml.py ........ | |
astropy/utils/xml/writer.py s | |
astropy/visualization/scripts/tests/test_fits2bitmap.py .. | |
astropy/visualization/tests/test_histogram.py ... | |
astropy/visualization/tests/test_interval.py ................. | |
astropy/visualization/tests/test_norm.py s...... | |
astropy/visualization/tests/test_stretch.py ................................................................................................... | |
astropy/visualization/tests/test_ui.py ...... | |
astropy/visualization/tests/test_units.py .. | |
astropy/vo/client/tests/test_conesearch.py ......x..........x. | |
astropy/vo/client/tests/test_vos_catalog.py ............... | |
astropy/vo/samp/tests/test_client.py .... | |
astropy/vo/samp/tests/test_errors.py ... | |
astropy/vo/samp/tests/test_hub.py ... | |
astropy/vo/samp/tests/test_hub_proxy.py ..... | |
astropy/vo/samp/tests/test_hub_script.py . | |
astropy/vo/samp/tests/test_standard_profile.py ... | |
astropy/vo/samp/tests/test_web_profile.py .. | |
astropy/vo/validator/tests/test_inpect.py .... | |
astropy/vo/validator/tests/test_validate.py .... | |
astropy/wcs/tests/test_pickle.py ...... | |
astropy/wcs/tests/test_profiling.py .................................. | |
astropy/wcs/tests/test_utils.py ......................................... | |
astropy/wcs/tests/test_wcs.py .......................................................................... | |
astropy/wcs/tests/test_wcsprm.py ...........................................................................................................XX.. | |
astropy/wcs/tests/extension/test_extension.py . | |
==================================== ERRORS ==================================== | |
_____________________ ERROR collecting astropy/conftest.py _____________________ | |
_pytest.runner:149: in __init__ | |
??? | |
_pytest.main:431: in _memocollect | |
??? | |
_pytest.main:311: in _memoizedcall | |
??? | |
_pytest.main:431: in <lambda> | |
??? | |
astropy/tests/pytest_plugins.py:162: in collect | |
module = self.config._conftest.importconftest(self.fspath) | |
E AttributeError: 'Config' object has no attribute '_conftest' | |
_______________ ERROR collecting astropy/table/tests/conftest.py _______________ | |
_pytest.runner:149: in __init__ | |
??? | |
_pytest.main:431: in _memocollect | |
??? | |
_pytest.main:311: in _memoizedcall | |
??? | |
_pytest.main:431: in <lambda> | |
??? | |
astropy/tests/pytest_plugins.py:162: in collect | |
module = self.config._conftest.importconftest(self.fspath) | |
E AttributeError: 'Config' object has no attribute '_conftest' | |
=================================== FAILURES =================================== | |
__________________________________ test_names __________________________________ | |
@remote_data | |
def test_names(): | |
# First check that sesame is up | |
if urllib.request.urlopen("http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame").getcode() != 200: | |
pytest.skip("SESAME appears to be down, skipping test_name_resolve.py:test_names()...") | |
with pytest.raises(NameResolveError): | |
get_icrs_coordinates("m87h34hhh") | |
try: | |
icrs = get_icrs_coordinates("ngc 3642") | |
except NameResolveError: | |
ra, dec = _parse_response(_cached_ngc3642["all"]) | |
icrs = SkyCoord(ra=float(ra)*u.degree, dec=float(dec)*u.degree) | |
icrs_true = SkyCoord(ra="11h 22m 18.014s", dec="59d 04m 27.27s") | |
np.testing.assert_almost_equal(icrs.ra.degree, icrs_true.ra.degree, 3) | |
np.testing.assert_almost_equal(icrs.dec.degree, icrs_true.dec.degree, 3) | |
try: | |
icrs = get_icrs_coordinates("castor") | |
except NameResolveError: | |
ra,dec = _parse_response(_cached_castor["all"]) | |
icrs = SkyCoord(ra=float(ra)*u.degree, dec=float(dec)*u.degree) | |
icrs_true = SkyCoord(ra="07h 34m 35.87s", dec="+31d 53m 17.8s") | |
> np.testing.assert_almost_equal(icrs.ra.degree, icrs_true.ra.degree, 3) | |
astropy/coordinates/tests/test_name_resolve.py:136: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
actual = 113.6566, desired = 113.64945833333331, decimal = 3, err_msg = '' | |
verbose = True | |
def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): | |
""" | |
Raises an AssertionError if two items are not equal up to desired | |
precision. | |
.. note:: It is recommended to use one of `assert_allclose`, | |
`assert_array_almost_equal_nulp` or `assert_array_max_ulp` | |
instead of this function for more consistent floating point | |
comparisons. | |
The test is equivalent to ``abs(desired-actual) < 0.5 * 10**(-decimal)``. | |
Given two objects (numbers or ndarrays), check that all elements of these | |
objects are almost equal. An exception is raised at conflicting values. | |
For ndarrays this delegates to assert_array_almost_equal | |
Parameters | |
---------- | |
actual : array_like | |
The object to check. | |
desired : array_like | |
The expected object. | |
decimal : int, optional | |
Desired precision, default is 7. | |
err_msg : str, optional | |
The error message to be printed in case of failure. | |
verbose : bool, optional | |
If True, the conflicting values are appended to the error message. | |
Raises | |
------ | |
AssertionError | |
If actual and desired are not equal up to specified precision. | |
See Also | |
-------- | |
assert_allclose: Compare two array_like objects for equality with desired | |
relative and/or absolute precision. | |
assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal | |
Examples | |
-------- | |
>>> import numpy.testing as npt | |
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334) | |
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334, decimal=10) | |
... | |
<type 'exceptions.AssertionError'>: | |
Items are not equal: | |
ACTUAL: 2.3333333333333002 | |
DESIRED: 2.3333333399999998 | |
>>> npt.assert_almost_equal(np.array([1.0,2.3333333333333]), | |
... np.array([1.0,2.33333334]), decimal=9) | |
... | |
<type 'exceptions.AssertionError'>: | |
Arrays are not almost equal | |
<BLANKLINE> | |
(mismatch 50.0%) | |
x: array([ 1. , 2.33333333]) | |
y: array([ 1. , 2.33333334]) | |
""" | |
from numpy.core import ndarray | |
from numpy.lib import iscomplexobj, real, imag | |
# Handle complex numbers: separate into real/imag to handle | |
# nan/inf/negative zero correctly | |
# XXX: catch ValueError for subclasses of ndarray where iscomplex fail | |
try: | |
usecomplex = iscomplexobj(actual) or iscomplexobj(desired) | |
except ValueError: | |
usecomplex = False | |
def _build_err_msg(): | |
header = ('Arrays are not almost equal to %d decimals' % decimal) | |
return build_err_msg([actual, desired], err_msg, verbose=verbose, | |
header=header) | |
if usecomplex: | |
if iscomplexobj(actual): | |
actualr = real(actual) | |
actuali = imag(actual) | |
else: | |
actualr = actual | |
actuali = 0 | |
if iscomplexobj(desired): | |
desiredr = real(desired) | |
desiredi = imag(desired) | |
else: | |
desiredr = desired | |
desiredi = 0 | |
try: | |
assert_almost_equal(actualr, desiredr, decimal=decimal) | |
assert_almost_equal(actuali, desiredi, decimal=decimal) | |
except AssertionError: | |
raise AssertionError(_build_err_msg()) | |
if isinstance(actual, (ndarray, tuple, list)) \ | |
or isinstance(desired, (ndarray, tuple, list)): | |
return assert_array_almost_equal(actual, desired, decimal, err_msg) | |
try: | |
# If one of desired/actual is not finite, handle it specially here: | |
# check that both are nan if any is a nan, and test for equality | |
# otherwise | |
if not (gisfinite(desired) and gisfinite(actual)): | |
if gisnan(desired) or gisnan(actual): | |
if not (gisnan(desired) and gisnan(actual)): | |
raise AssertionError(_build_err_msg()) | |
else: | |
if not desired == actual: | |
raise AssertionError(_build_err_msg()) | |
return | |
except (NotImplementedError, TypeError): | |
pass | |
if round(abs(desired - actual), decimal) != 0: | |
> raise AssertionError(_build_err_msg()) | |
E AssertionError: | |
E Arrays are not almost equal to 3 decimals | |
E ACTUAL: 113.6566 | |
E DESIRED: 113.64945833333331 | |
/sw/lib/python3.4/site-packages/numpy/testing/utils.py:510: AssertionError | |
1 failed, 7251 passed, 131 skipped, 41 xfailed, 2 xpassed, 2 error in 511.12 seconds | |
============================= test session starts ============================== | |
platform darwin -- Python 3.4.3, pytest-2.8.3, py-1.4.30, pluggy-0.3.1 | |
Running tests with Astropy version 1.1.dev14144. | |
Running tests in astropy. | |
Date: 2015-11-25T15:05:22 | |
Platform: Darwin-14.5.0-x86_64-i386-64bit | |
Executable: /Users/bsipocz/.virtualenvs/astropy-dev/bin/python3 | |
Full Python Version: | |
3.4.3 (default, Feb 26 2015, 11:16:38) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] | |
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8 | |
byteorder: little | |
float info: dig: 15, mant_dig: 15 | |
Numpy: 1.10.1 | |
Scipy: 0.16.0 | |
Matplotlib: 1.5.0 | |
h5py: not available | |
Using Astropy options: remote_data. | |
rootdir: /Users/bsipocz/munka/devel/astropy, inifile: setup.cfg | |
collected 7286 items / 2 errors | |
astropy/_erfa/tests/test_erfa.py ..... | |
astropy/analytic_functions/tests/test_blackbody.py ..... | |
astropy/config/configuration.py . | |
astropy/config/tests/test_configs.py ................. | |
astropy/constants/__init__.py . | |
astropy/constants/tests/test_constant.py ........ | |
astropy/constants/tests/test_pickle.py sss | |
astropy/convolution/kernels.py ... | |
astropy/convolution/tests/test_convolve.py ............................................................................................................... | |
astropy/convolution/tests/test_convolve_fft.py ................................................................................................................................................................................................................................................................................................................................................... | |
astropy/convolution/tests/test_convolve_kernels.py .............................................................................. | |
astropy/convolution/tests/test_discretize.py ...s...........s............... | |
astropy/convolution/tests/test_kernel_class.py ........................................................................................................................................................................................ | |
astropy/convolution/tests/test_pickle.py .xx.xx.xx | |
astropy/coordinates/angles.py .. | |
astropy/coordinates/baseframe.py . | |
astropy/coordinates/sky_coordinate.py .. | |
astropy/coordinates/builtin_frames/galactocentric.py . | |
astropy/coordinates/tests/test_angles.py ........................................ | |
astropy/coordinates/tests/test_angular_separation.py .... | |
astropy/coordinates/tests/test_api_ape5.py ..... | |
astropy/coordinates/tests/test_arrays.py ............. | |
astropy/coordinates/tests/test_celestial_transformations.py .......... | |
astropy/coordinates/tests/test_distance.py .F....... | |
astropy/coordinates/tests/test_earth.py ............. | |
astropy/coordinates/tests/test_formatting.py .......... | |
astropy/coordinates/tests/test_frames.py ......................F. | |
astropy/coordinates/tests/test_funcs.py ... | |
astropy/coordinates/tests/test_iau_fullstack.py .................................................... | |
astropy/coordinates/tests/test_intermediate_transformations.py ................................................... | |
astropy/coordinates/tests/test_matching.py ...... | |
astropy/coordinates/tests/test_name_resolve.py F.. | |
astropy/coordinates/tests/test_pickle.py ..sss | |
astropy/coordinates/tests/test_regression.py ....... | |
astropy/coordinates/tests/test_representation.py ............................................................................. | |
astropy/coordinates/tests/test_sites.py ....... | |
astropy/coordinates/tests/test_sky_coord.py ........................................................................................................................................................................................................................................................................................................................................................................................x................. | |
astropy/coordinates/tests/test_transformations.py ...... | |
astropy/coordinates/tests/test_unit_representation.py . | |
astropy/coordinates/tests/accuracy/test_altaz_icrs.py ...x | |
astropy/coordinates/tests/accuracy/test_ecliptic.py ... | |
astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.py . | |
astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py . | |
astropy/coordinates/tests/accuracy/test_galactic_fk4.py . | |
astropy/coordinates/tests/accuracy/test_icrs_fk5.py . | |
astropy/cosmology/tests/test_cosmology.py ..................................... | |
astropy/cosmology/tests/test_pickle.py sss | |
astropy/io/ascii/daophot.py . | |
astropy/io/ascii/ipac.py . | |
astropy/io/ascii/tests/test_c_reader.py .................FF........x.........FF.......x.....FFx.x...............FF | |
astropy/io/ascii/tests/test_cds_header_from_readme.py ... | |
astropy/io/ascii/tests/test_compressed.py ....... | |
astropy/io/ascii/tests/test_connect.py ........................ | |
astropy/io/ascii/tests/test_ecsv.py ....... | |
astropy/io/ascii/tests/test_fixedwidth.py ............................... | |
astropy/io/ascii/tests/test_html.py ........s....... | |
astropy/io/ascii/tests/test_ipac_definitions.py .................... | |
astropy/io/ascii/tests/test_read.py ...............................................................................................F......... | |
astropy/io/ascii/tests/test_types.py .F. | |
astropy/io/ascii/tests/test_write.py ............... | |
astropy/io/fits/diff.py . | |
astropy/io/fits/util.py .. | |
astropy/io/fits/tests/test_checksum.py ..................... | |
astropy/io/fits/tests/test_connect.py .......................... | |
astropy/io/fits/tests/test_core.py .................................................ss.......... | |
astropy/io/fits/tests/test_diff.py ................................... | |
astropy/io/fits/tests/test_division.py ..... | |
astropy/io/fits/tests/test_groups.py ........ | |
astropy/io/fits/tests/test_hdulist.py ......................................... | |
astropy/io/fits/tests/test_header.py ................................................................................................................................................ | |
astropy/io/fits/tests/test_image.py ...................................................... | |
astropy/io/fits/tests/test_nonstandard.py ... | |
astropy/io/fits/tests/test_structured.py . | |
astropy/io/fits/tests/test_table.py .................................x..................................... | |
astropy/io/fits/tests/test_uint.py ........ | |
astropy/io/fits/tests/test_util.py . | |
astropy/io/misc/tests/test_hdf5.py sssssssssssssssssssssssssssssssssssssssss | |
astropy/io/misc/tests/test_pickle_helpers.py .... | |
astropy/io/tests/test_registry.py .............................. | |
astropy/io/votable/tests/converter_test.py ...................... | |
astropy/io/votable/tests/exception_test.py .. | |
astropy/io/votable/tests/table_test.py ........ | |
astropy/io/votable/tests/tree_test.py ... | |
astropy/io/votable/tests/ucd_test.py ..... | |
astropy/io/votable/tests/util_test.py ........... | |
astropy/io/votable/tests/vo_test.py ......................................................................................................................................................................... | |
astropy/modeling/_compound_deprecated.py .. | |
astropy/modeling/core.py ..s.. | |
astropy/modeling/functional_models.py . | |
astropy/modeling/mappings.py .. | |
astropy/modeling/parameters.py . | |
astropy/modeling/utils.py .. | |
astropy/modeling/tests/test_compound.py ..........................................FF........s | |
astropy/modeling/tests/test_constraints.py ..................... | |
astropy/modeling/tests/test_core.py ............. | |
astropy/modeling/tests/test_fitters.py ................... | |
astropy/modeling/tests/test_functional_models.py ........... | |
astropy/modeling/tests/test_input.py ...................................................... | |
astropy/modeling/tests/test_mappings.py ...... | |
astropy/modeling/tests/test_models.py .............................................sss.s.sssss.ssss....................ss.s....s.........................sss.s..s..s...........sssss.s.sss.... | |
astropy/modeling/tests/test_parameters.py .................................................... | |
astropy/modeling/tests/test_polynomial.py ............................s......... | |
astropy/modeling/tests/test_projections.py ....................................................................................... | |
astropy/modeling/tests/test_rotations.py ............. | |
astropy/modeling/tests/test_utils.py ... | |
astropy/nddata/utils.py ...... | |
astropy/nddata/mixins/tests/test_ndarithmetic.py ........................................................ | |
astropy/nddata/mixins/tests/test_ndio.py . | |
astropy/nddata/tests/test_compat.py ................ | |
astropy/nddata/tests/test_decorators.py .......... | |
astropy/nddata/tests/test_flag_collection.py .......... | |
astropy/nddata/tests/test_nddata.py .................................. | |
astropy/nddata/tests/test_nddata_base.py . | |
astropy/nddata/tests/test_utils.py ....................s........................... | |
astropy/stats/bayesian_blocks.py . | |
astropy/stats/funcs.py ..... | |
astropy/stats/sigma_clipping.py .. | |
astropy/stats/tests/test_bayesian_blocks.py ....... | |
astropy/stats/tests/test_funcs.py .................................. | |
astropy/stats/tests/test_histogram.py ......... | |
astropy/stats/tests/test_sigma_clipping.py ..... | |
astropy/table/info.py .. | |
astropy/table/meta.py s. | |
astropy/table/np_utils.py .. | |
astropy/table/operations.py .. | |
astropy/table/row.py . | |
astropy/table/table.py ............. | |
astropy/table/table_helpers.py . | |
astropy/table/tests/test_array.py ... | |
astropy/table/tests/test_bst.py ....... | |
astropy/table/tests/test_column.py ................................................................................... | |
astropy/table/tests/test_groups.py ....................FF........FFFFFFFF | |
astropy/table/tests/test_index.py ................................................................................................................................................................................................................................................................................................................................................................................................................................................ | |
astropy/table/tests/test_info.py ............ | |
astropy/table/tests/test_init_table.py ................................................................................................................................................... | |
astropy/table/tests/test_item_access.py .............................. | |
astropy/table/tests/test_jsviewer.py ... | |
astropy/table/tests/test_masked.py .................................. | |
astropy/table/tests/test_mixin.py ..............................................................x.... | |
astropy/table/tests/test_np_utils.py . | |
astropy/table/tests/test_operations.py ...................................... | |
astropy/table/tests/test_pickle.py ............... | |
astropy/table/tests/test_pprint.py ........................................................ | |
astropy/table/tests/test_row.py .................................. | |
astropy/table/tests/test_subclass.py .. | |
astropy/table/tests/test_table.py ................................................................................................................................................................................................................................................................................................x........................................ | |
astropy/tests/test_logger.py ............................. | |
astropy/tests/tests/test_imports.py .. | |
astropy/tests/tests/test_open_file_detection.py . | |
astropy/tests/tests/test_quantity_helpers.py . | |
astropy/tests/tests/test_run_tests.py .... | |
astropy/tests/tests/test_skip_remote_data.py . | |
astropy/tests/tests/test_socketblocker.py .... | |
astropy/time/core.py FF.. | |
astropy/time/formats.py .. | |
astropy/time/tests/test_basic.py ....................................................... | |
astropy/time/tests/test_comparisons.py ... | |
astropy/time/tests/test_delta.py ................................................................................. | |
astropy/time/tests/test_guess.py .... | |
astropy/time/tests/test_methods.py ..........ss....... | |
astropy/time/tests/test_pickle.py . | |
astropy/time/tests/test_precision.py .......x.. | |
astropy/time/tests/test_quantity_interaction.py ............... | |
astropy/time/tests/test_sidereal.py ................... | |
astropy/time/tests/test_ut1.py ...s | |
astropy/units/cds.py . | |
astropy/units/core.py .... | |
astropy/units/equivalencies.py .... | |
astropy/units/imperial.py . | |
astropy/units/format/console.py . | |
astropy/units/format/unicode_format.py . | |
astropy/units/function/logarithmic.py . | |
astropy/units/tests/test_equivalencies.py ..................................................... | |
astropy/units/tests/test_format.py ................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. | |
astropy/units/tests/test_logarithmic.py .s...ss.s...s................ss............................................................. | |
astropy/units/tests/test_physical.py ........... | |
astropy/units/tests/test_quantity.py ...................................................................... | |
astropy/units/tests/test_quantity_array_methods.py .............................x............x.x............. | |
astropy/units/tests/test_quantity_decorator.py ............................ | |
astropy/units/tests/test_quantity_non_ufuncs.py xx | |
astropy/units/tests/test_quantity_ufuncs.py .......................................................................................................................................................... | |
astropy/units/tests/test_units.py ............................................................................................................................................................................................................................................................................................................................................................................................................................................ | |
astropy/utils/data.py .... | |
astropy/utils/data_info.py .. | |
astropy/utils/decorators.py ... | |
astropy/utils/introspection.py ... | |
astropy/utils/misc.py ... | |
astropy/utils/timer.py . | |
astropy/utils/iers/iers.py . | |
astropy/utils/iers/tests/test_iers.py ....s | |
astropy/utils/tests/test_codegen.py . | |
astropy/utils/tests/test_collections.py ..... | |
astropy/utils/tests/test_compat.py . | |
astropy/utils/tests/test_console.py .......s................. | |
astropy/utils/tests/test_data.py .......................... | |
astropy/utils/tests/test_data_info.py ............. | |
astropy/utils/tests/test_decorators.py ........s.. | |
astropy/utils/tests/test_gzip.py .. | |
astropy/utils/tests/test_introspection.py .... | |
astropy/utils/tests/test_metadata.py ............... | |
astropy/utils/tests/test_misc.py ..... | |
astropy/utils/tests/test_odict.py sssssssssssssssssssssssssssssssssssssssssss | |
astropy/utils/tests/test_state.py F. | |
astropy/utils/tests/test_timer.py . | |
astropy/utils/tests/test_xml.py ........ | |
astropy/utils/xml/writer.py s | |
astropy/visualization/scripts/tests/test_fits2bitmap.py .. | |
astropy/visualization/tests/test_histogram.py ... | |
astropy/visualization/tests/test_interval.py ................. | |
astropy/visualization/tests/test_norm.py s...... | |
astropy/visualization/tests/test_stretch.py ................................................................................................... | |
astropy/visualization/tests/test_ui.py ...... | |
astropy/visualization/tests/test_units.py .. | |
astropy/vo/client/tests/test_conesearch.py ......x..........x. | |
astropy/vo/client/tests/test_vos_catalog.py ..............F | |
astropy/vo/samp/tests/test_client.py .... | |
astropy/vo/samp/tests/test_errors.py ... | |
astropy/vo/samp/tests/test_hub.py ... | |
astropy/vo/samp/tests/test_hub_proxy.py ..... | |
astropy/vo/samp/tests/test_hub_script.py . | |
astropy/vo/samp/tests/test_standard_profile.py ... | |
astropy/vo/samp/tests/test_web_profile.py .. | |
astropy/vo/validator/tests/test_inpect.py .... | |
astropy/vo/validator/tests/test_validate.py .... | |
astropy/wcs/tests/test_pickle.py ...... | |
astropy/wcs/tests/test_profiling.py .................................. | |
astropy/wcs/tests/test_utils.py ......................................... | |
astropy/wcs/tests/test_wcs.py .......................................................................... | |
astropy/wcs/tests/test_wcsprm.py ...........................................................................................................XX.. | |
astropy/wcs/tests/extension/test_extension.py . | |
==================================== ERRORS ==================================== | |
_____________________ ERROR collecting astropy/conftest.py _____________________ | |
_pytest.runner:149: in __init__ | |
??? | |
_pytest.main:431: in _memocollect | |
??? | |
_pytest.main:311: in _memoizedcall | |
??? | |
_pytest.main:431: in <lambda> | |
??? | |
astropy/tests/pytest_plugins.py:162: in collect | |
module = self.config._conftest.importconftest(self.fspath) | |
E AttributeError: 'Config' object has no attribute '_conftest' | |
_______________ ERROR collecting astropy/table/tests/conftest.py _______________ | |
_pytest.runner:149: in __init__ | |
??? | |
_pytest.main:431: in _memocollect | |
??? | |
_pytest.main:311: in _memoizedcall | |
??? | |
_pytest.main:431: in <lambda> | |
??? | |
astropy/tests/pytest_plugins.py:162: in collect | |
module = self.config._conftest.importconftest(self.fspath) | |
E AttributeError: 'Config' object has no attribute '_conftest' | |
=================================== FAILURES =================================== | |
_____________________________ test_distances_scipy _____________________________ | |
@pytest.mark.skipif(str('not HAS_SCIPY')) | |
def test_distances_scipy(): | |
""" | |
The distance-related tests that require scipy due to the cosmology | |
module needing scipy integration routines | |
""" | |
from ...cosmology import WMAP5 | |
#try different ways to initialize a Distance | |
d4 = Distance(z=0.23) # uses default cosmology - as of writing, WMAP7 | |
> npt.assert_allclose(d4.z, 0.23, rtol=1e-8) | |
astropy/coordinates/tests/test_distance.py:123: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/sw/lib/python3.4/site-packages/numpy/testing/utils.py:1347: in assert_allclose | |
verbose=verbose, header=header) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
comparison = <function assert_allclose.<locals>.compare at 0x114c970d0> | |
x = array(0.2300000025478198), y = array(0.23), err_msg = '', verbose = True | |
header = 'Not equal to tolerance rtol=1e-08, atol=0', precision = 6 | |
def assert_array_compare(comparison, x, y, err_msg='', verbose=True, | |
header='', precision=6): | |
from numpy.core import array, isnan, isinf, any, all, inf | |
x = array(x, copy=False, subok=True) | |
y = array(y, copy=False, subok=True) | |
def safe_comparison(*args, **kwargs): | |
# There are a number of cases where comparing two arrays hits special | |
# cases in array_richcompare, specifically around strings and void | |
# dtypes. Basically, we just can't do comparisons involving these | |
# types, unless both arrays have exactly the *same* type. So | |
# e.g. you can apply == to two string arrays, or two arrays with | |
# identical structured dtypes. But if you compare a non-string array | |
# to a string array, or two arrays with non-identical structured | |
# dtypes, or anything like that, then internally stuff blows up. | |
# Currently, when things blow up, we just return a scalar False or | |
# True. But we also emit a DeprecationWarning, b/c eventually we | |
# should raise an error here. (Ideally we might even make this work | |
# properly, but since that will require rewriting a bunch of how | |
# ufuncs work then we are not counting on that.) | |
# | |
# The point of this little function is to let the DeprecationWarning | |
# pass (or maybe eventually catch the errors and return False, I | |
# dunno, that's a little trickier and we can figure that out when the | |
# time comes). | |
with warnings.catch_warnings(): | |
warnings.filterwarnings("ignore", category=DeprecationWarning) | |
return comparison(*args, **kwargs) | |
def isnumber(x): | |
return x.dtype.char in '?bhilqpBHILQPefdgFDG' | |
def chk_same_position(x_id, y_id, hasval='nan'): | |
"""Handling nan/inf: check that x and y have the nan/inf at the same | |
locations.""" | |
try: | |
assert_array_equal(x_id, y_id) | |
except AssertionError: | |
msg = build_err_msg([x, y], | |
err_msg + '\nx and y %s location mismatch:' | |
% (hasval), verbose=verbose, header=header, | |
names=('x', 'y'), precision=precision) | |
raise AssertionError(msg) | |
try: | |
cond = (x.shape == () or y.shape == ()) or x.shape == y.shape | |
if not cond: | |
msg = build_err_msg([x, y], | |
err_msg | |
+ '\n(shapes %s, %s mismatch)' % (x.shape, | |
y.shape), | |
verbose=verbose, header=header, | |
names=('x', 'y'), precision=precision) | |
if not cond: | |
raise AssertionError(msg) | |
if isnumber(x) and isnumber(y): | |
x_isnan, y_isnan = isnan(x), isnan(y) | |
x_isinf, y_isinf = isinf(x), isinf(y) | |
# Validate that the special values are in the same place | |
if any(x_isnan) or any(y_isnan): | |
chk_same_position(x_isnan, y_isnan, hasval='nan') | |
if any(x_isinf) or any(y_isinf): | |
# Check +inf and -inf separately, since they are different | |
chk_same_position(x == +inf, y == +inf, hasval='+inf') | |
chk_same_position(x == -inf, y == -inf, hasval='-inf') | |
# Combine all the special values | |
x_id, y_id = x_isnan, y_isnan | |
x_id |= x_isinf | |
y_id |= y_isinf | |
# Only do the comparison if actual values are left | |
if all(x_id): | |
return | |
if any(x_id): | |
val = safe_comparison(x[~x_id], y[~y_id]) | |
else: | |
val = safe_comparison(x, y) | |
else: | |
val = safe_comparison(x, y) | |
if isinstance(val, bool): | |
cond = val | |
reduced = [0] | |
else: | |
reduced = val.ravel() | |
cond = reduced.all() | |
reduced = reduced.tolist() | |
if not cond: | |
match = 100-100.0*reduced.count(1)/len(reduced) | |
msg = build_err_msg([x, y], | |
err_msg | |
+ '\n(mismatch %s%%)' % (match,), | |
verbose=verbose, header=header, | |
names=('x', 'y'), precision=precision) | |
if not cond: | |
> raise AssertionError(msg) | |
E AssertionError: | |
E Not equal to tolerance rtol=1e-08, atol=0 | |
E | |
E (mismatch 100.0%) | |
E x: array(0.2300000025478198) | |
E y: array(0.23) | |
/sw/lib/python3.4/site-packages/numpy/testing/utils.py:708: AssertionError | |
_________________________ test_representation_subclass _________________________ | |
def test_representation_subclass(): | |
# Regression test for #3354 | |
from ..builtin_frames import FK5 | |
# Normally when instantiating a frame without a distance the frame will try | |
# and use UnitSphericalRepresentation internally instead of | |
# SphericalRepresentation. | |
frame = FK5(representation=representation.SphericalRepresentation, ra=32 * u.deg, dec=20 * u.deg) | |
assert type(frame._data) == representation.UnitSphericalRepresentation | |
assert frame.representation == representation.SphericalRepresentation | |
# If using a SphericalRepresentation class this used to not work, so we | |
# test here that this is now fixed. | |
> class NewSphericalRepresentation(representation.SphericalRepresentation): | |
astropy/coordinates/tests/test_frames.py:630: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
cls = <class 'astropy.coordinates.tests.test_frames.test_representation_subclass.<locals>.NewSphericalRepresentation'> | |
name = 'NewSphericalRepresentation' | |
bases = (<class 'astropy.coordinates.representation.SphericalRepresentation'>,) | |
dct = {'__module__': 'astropy.coordinates.tests.test_frames', '__qualname__': 'test_representation_subclass.<locals>.NewSphe...'>), ('lat', <class 'astropy.coordinates.angles.Latitude'>), ('distance', <class 'astropy.units.quantity.Quantity'>)])} | |
def __init__(cls, name, bases, dct): | |
super(MetaBaseRepresentation, cls).__init__(name, bases, dct) | |
if name != 'BaseRepresentation' and 'attr_classes' not in dct: | |
raise NotImplementedError('Representations must have an ' | |
'"attr_classes" class attribute.') | |
# Register representation name (except for BaseRepresentation) | |
if cls.__name__ == 'BaseRepresentation': | |
return | |
repr_name = cls.get_name() | |
if repr_name in REPRESENTATION_CLASSES: | |
> raise ValueError("Representation class {0} already defined".format(repr_name)) | |
E ValueError: Representation class newspherical already defined | |
astropy/coordinates/representation.py:48: ValueError | |
__________________________________ test_names __________________________________ | |
@remote_data | |
def test_names(): | |
# First check that sesame is up | |
if urllib.request.urlopen("http://cdsweb.u-strasbg.fr/cgi-bin/nph-sesame").getcode() != 200: | |
pytest.skip("SESAME appears to be down, skipping test_name_resolve.py:test_names()...") | |
with pytest.raises(NameResolveError): | |
get_icrs_coordinates("m87h34hhh") | |
try: | |
icrs = get_icrs_coordinates("ngc 3642") | |
except NameResolveError: | |
ra, dec = _parse_response(_cached_ngc3642["all"]) | |
icrs = SkyCoord(ra=float(ra)*u.degree, dec=float(dec)*u.degree) | |
icrs_true = SkyCoord(ra="11h 22m 18.014s", dec="59d 04m 27.27s") | |
> np.testing.assert_almost_equal(icrs.ra.degree, icrs_true.ra.degree, 3) | |
astropy/coordinates/tests/test_name_resolve.py:126: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
actual = 170.5745485, desired = 170.57505833333332, decimal = 3, err_msg = '' | |
verbose = True | |
def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=True): | |
""" | |
Raises an AssertionError if two items are not equal up to desired | |
precision. | |
.. note:: It is recommended to use one of `assert_allclose`, | |
`assert_array_almost_equal_nulp` or `assert_array_max_ulp` | |
instead of this function for more consistent floating point | |
comparisons. | |
The test is equivalent to ``abs(desired-actual) < 0.5 * 10**(-decimal)``. | |
Given two objects (numbers or ndarrays), check that all elements of these | |
objects are almost equal. An exception is raised at conflicting values. | |
For ndarrays this delegates to assert_array_almost_equal | |
Parameters | |
---------- | |
actual : array_like | |
The object to check. | |
desired : array_like | |
The expected object. | |
decimal : int, optional | |
Desired precision, default is 7. | |
err_msg : str, optional | |
The error message to be printed in case of failure. | |
verbose : bool, optional | |
If True, the conflicting values are appended to the error message. | |
Raises | |
------ | |
AssertionError | |
If actual and desired are not equal up to specified precision. | |
See Also | |
-------- | |
assert_allclose: Compare two array_like objects for equality with desired | |
relative and/or absolute precision. | |
assert_array_almost_equal_nulp, assert_array_max_ulp, assert_equal | |
Examples | |
-------- | |
>>> import numpy.testing as npt | |
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334) | |
>>> npt.assert_almost_equal(2.3333333333333, 2.33333334, decimal=10) | |
... | |
<type 'exceptions.AssertionError'>: | |
Items are not equal: | |
ACTUAL: 2.3333333333333002 | |
DESIRED: 2.3333333399999998 | |
>>> npt.assert_almost_equal(np.array([1.0,2.3333333333333]), | |
... np.array([1.0,2.33333334]), decimal=9) | |
... | |
<type 'exceptions.AssertionError'>: | |
Arrays are not almost equal | |
<BLANKLINE> | |
(mismatch 50.0%) | |
x: array([ 1. , 2.33333333]) | |
y: array([ 1. , 2.33333334]) | |
""" | |
from numpy.core import ndarray | |
from numpy.lib import iscomplexobj, real, imag | |
# Handle complex numbers: separate into real/imag to handle | |
# nan/inf/negative zero correctly | |
# XXX: catch ValueError for subclasses of ndarray where iscomplex fail | |
try: | |
usecomplex = iscomplexobj(actual) or iscomplexobj(desired) | |
except ValueError: | |
usecomplex = False | |
def _build_err_msg(): | |
header = ('Arrays are not almost equal to %d decimals' % decimal) | |
return build_err_msg([actual, desired], err_msg, verbose=verbose, | |
header=header) | |
if usecomplex: | |
if iscomplexobj(actual): | |
actualr = real(actual) | |
actuali = imag(actual) | |
else: | |
actualr = actual | |
actuali = 0 | |
if iscomplexobj(desired): | |
desiredr = real(desired) | |
desiredi = imag(desired) | |
else: | |
desiredr = desired | |
desiredi = 0 | |
try: | |
assert_almost_equal(actualr, desiredr, decimal=decimal) | |
assert_almost_equal(actuali, desiredi, decimal=decimal) | |
except AssertionError: | |
raise AssertionError(_build_err_msg()) | |
if isinstance(actual, (ndarray, tuple, list)) \ | |
or isinstance(desired, (ndarray, tuple, list)): | |
return assert_array_almost_equal(actual, desired, decimal, err_msg) | |
try: | |
# If one of desired/actual is not finite, handle it specially here: | |
# check that both are nan if any is a nan, and test for equality | |
# otherwise | |
if not (gisfinite(desired) and gisfinite(actual)): | |
if gisnan(desired) or gisnan(actual): | |
if not (gisnan(desired) and gisnan(actual)): | |
raise AssertionError(_build_err_msg()) | |
else: | |
if not desired == actual: | |
raise AssertionError(_build_err_msg()) | |
return | |
except (NotImplementedError, TypeError): | |
pass | |
if round(abs(desired - actual), decimal) != 0: | |
> raise AssertionError(_build_err_msg()) | |
E AssertionError: | |
E Arrays are not almost equal to 3 decimals | |
E ACTUAL: 170.5745485 | |
E DESIRED: 170.57505833333332 | |
/sw/lib/python3.4/site-packages/numpy/testing/utils.py:510: AssertionError | |
____________________________ test_conversion[True] _____________________________ | |
parallel = True | |
read_basic = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_conversion_True_0'), format='basic', Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_conversion(parallel, read_basic): | |
""" | |
The reader should try to convert each column to ints. If this fails, the | |
reader should try to convert to floats. Failing this, it should fall back | |
to strings. | |
""" | |
text = """ | |
A B C D E | |
1 a 3 4 5 | |
2. 1 9 10 -5.3e4 | |
4 2 -12 .4 six | |
""" | |
> table = read_basic(text, parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:248: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
____________________________ test_conversion[False] ____________________________ | |
parallel = False | |
read_basic = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_conversion_False_0'), format='basic', Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_conversion(parallel, read_basic): | |
""" | |
The reader should try to convert each column to ints. If this fails, the | |
reader should try to convert to floats. Failing this, it should fall back | |
to strings. | |
""" | |
text = """ | |
A B C D E | |
1 a 3 4 5 | |
2. 1 9 10 -5.3e4 | |
4 2 -12 .4 six | |
""" | |
> table = read_basic(text, parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:248: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
____________________________ test_fill_values[True] ____________________________ | |
parallel = True | |
read_basic = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_fill_values_True_0'), format='basic', Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_fill_values(parallel, read_basic): | |
""" | |
Make sure that the parameter fill_values works as intended. If fill_values | |
is not specified, the default behavior should be to convert '' to 0. | |
""" | |
text = """ | |
A, B, C | |
, 2, nan | |
a, -999, -3.4 | |
nan, 5, -9999 | |
8, nan, 7.6e12 | |
""" | |
> table = read_basic(text, delimiter=',', parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:487: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
___________________________ test_fill_values[False] ____________________________ | |
parallel = False | |
read_basic = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_fill_values_False_0'), format='basic', Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_fill_values(parallel, read_basic): | |
""" | |
Make sure that the parameter fill_values works as intended. If fill_values | |
is not specified, the default behavior should be to convert '' to 0. | |
""" | |
text = """ | |
A, B, C | |
, 2, nan | |
a, -999, -3.4 | |
nan, 5, -9999 | |
8, nan, 7.6e12 | |
""" | |
> table = read_basic(text, delimiter=',', parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:487: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
________________________________ test_rdb[True] ________________________________ | |
parallel = True | |
read_rdb = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_rdb_True_0'), format='rdb', Reader=<class 'astropy.io.ascii.fastbasic.FastRdb'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_rdb(parallel, read_rdb): | |
""" | |
Make sure the FastRdb reader works as expected. | |
""" | |
text = """ | |
A\tB\tC | |
1n\tS\t4N | |
1\t 9\t4.3 | |
""" | |
> table = read_rdb(text, parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:682: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:58: in _read | |
t1 = reader.read(table) | |
astropy/io/ascii/fastbasic.py:108: in read | |
data, comments = self.engine.read(try_int, try_float, try_string) | |
astropy/io/ascii/cparser.pyx:382: in astropy.io.ascii.cparser.CParser.read (astropy/io/ascii/cparser.c:6571) | |
return self._convert_data(self.tokenizer, try_int, try_float, | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
> raise ValueError('Column {0} failed to convert'.format(name)) | |
E ValueError: Column C failed to convert | |
astropy/io/ascii/cparser.pyx:572: ValueError | |
_______________________________ test_rdb[False] ________________________________ | |
parallel = False | |
read_rdb = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-of-bsipocz/pytest-4/test_rdb_False_0'), format='rdb', Reader=<class 'astropy.io.ascii.fastbasic.FastRdb'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_rdb(parallel, read_rdb): | |
""" | |
Make sure the FastRdb reader works as expected. | |
""" | |
text = """ | |
A\tB\tC | |
1n\tS\t4N | |
1\t 9\t4.3 | |
""" | |
> table = read_rdb(text, parallel=parallel) | |
astropy/io/ascii/tests/test_c_reader.py:682: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:58: in _read | |
t1 = reader.read(table) | |
astropy/io/ascii/fastbasic.py:108: in read | |
data, comments = self.engine.read(try_int, try_float, try_string) | |
astropy/io/ascii/cparser.pyx:382: in astropy.io.ascii.cparser.CParser.read (astropy/io/ascii/cparser.c:6571) | |
return self._convert_data(self.tokenizer, try_int, try_float, | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
> raise ValueError('Column {0} failed to convert'.format(name)) | |
E ValueError: Column C failed to convert | |
astropy/io/ascii/cparser.pyx:572: ValueError | |
________________________ test_fast_tab_with_names[True] ________________________ | |
parallel = True | |
read_tab = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pyt...-bsipocz/pytest-4/test_fast_tab_with_names_True_0'), format='tab', Reader=<class 'astropy.io.ascii.fastbasic.FastTab'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_fast_tab_with_names(parallel, read_tab): | |
""" | |
Make sure the C reader doesn't segfault when the header for the | |
first column is missing [#3545] | |
""" | |
content = """# | |
\tdecDeg\tRate_pn_offAxis\tRate_mos2_offAxis\tObsID\tSourceID\tRADeg\tversion\tCounts_pn\tRate_pn\trun\tRate_mos1\tRate_mos2\tInserted_pn\tInserted_mos2\tbeta\tRate_mos1_offAxis\trcArcsec\tname\tInserted\tCounts_mos1\tInserted_mos1\tCounts_mos2\ty\tx\tCounts\toffAxis\tRot | |
-3.007559\t0.0000\t0.0010\t0013140201\t0\t213.462574\t0\t2\t0.0002\t0\t0.0001\t0.0001\t0\t1\t0.66\t0.0217\t3.0\tfakeXMMXCS J1413.8-0300\t3\t1\t2\t1\t398.000\t127.000\t5\t13.9\t72.3\t""" | |
head = ['A{0}'.format(i) for i in range(28)] | |
table = read_tab(content, data_start=1, | |
> parallel=parallel, names=head) | |
astropy/io/ascii/tests/test_c_reader.py:890: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
_______________________ test_fast_tab_with_names[False] ________________________ | |
parallel = False | |
read_tab = functools.partial(<function _read at 0x10e457378>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pyt...-bsipocz/pytest-4/test_fast_tab_with_names_False0'), format='tab', Reader=<class 'astropy.io.ascii.fastbasic.FastTab'>) | |
@pytest.mark.parametrize("parallel", [True, False]) | |
def test_fast_tab_with_names(parallel, read_tab): | |
""" | |
Make sure the C reader doesn't segfault when the header for the | |
first column is missing [#3545] | |
""" | |
content = """# | |
\tdecDeg\tRate_pn_offAxis\tRate_mos2_offAxis\tObsID\tSourceID\tRADeg\tversion\tCounts_pn\tRate_pn\trun\tRate_mos1\tRate_mos2\tInserted_pn\tInserted_mos2\tbeta\tRate_mos1_offAxis\trcArcsec\tname\tInserted\tCounts_mos1\tInserted_mos1\tCounts_mos2\ty\tx\tCounts\toffAxis\tRot | |
-3.007559\t0.0000\t0.0010\t0013140201\t0\t213.462574\t0\t2\t0.0002\t0\t0.0001\t0.0001\t0\t1\t0.66\t0.0217\t3.0\tfakeXMMXCS J1413.8-0300\t3\t1\t2\t1\t398.000\t127.000\t5\t13.9\t72.3\t""" | |
head = ['A{0}'.format(i) for i in range(28)] | |
table = read_tab(content, data_start=1, | |
> parallel=parallel, names=head) | |
astropy/io/ascii/tests/test_c_reader.py:890: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/io/ascii/tests/test_c_reader.py:66: in _read | |
assert_table_equal(t4, t5, check_meta=check_meta) | |
astropy/io/ascii/tests/test_c_reader.py:35: in assert_table_equal | |
assert_equal(t1[name].dtype.kind, t2[name].dtype.kind) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'U', b = 'f' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'U' == 'f' | |
E - U | |
E + f | |
astropy/io/ascii/tests/common.py:41: AssertionError | |
____________________________ test_pformat_roundtrip ____________________________ | |
def test_pformat_roundtrip(): | |
"""Check that the screen output of ``print tab`` can be read. See #3025.""" | |
"""Read a table with empty values and ensure that corresponding entries are masked""" | |
table = '\n'.join(['a,b,c,d', | |
'1,3,1.11,1', | |
'2, 2, 4.0 , ss ']) | |
dat = ascii.read(table) | |
out = ascii.read(dat.pformat()) | |
assert len(dat) == len(out) | |
assert dat.colnames == out.colnames | |
for c in dat.colnames: | |
> assert np.all(dat[c] == out[c]) | |
E assert <function all at 0x1098d4598>(<Column name=...h=2>\n1.11\n 4.0 == <Column name='...h=2>\n1.11\n 4.0 | |
E + where <function all at 0x1098d4598> = np.all | |
E Use -v to get the full diff) | |
test_read.py:926: AssertionError | |
_____________________________ test_rdb_write_types _____________________________ | |
def test_rdb_write_types(): | |
dat = ascii.read(['a b c d', '1 1.0 cat 2.1'], | |
Reader=ascii.Basic) | |
out = StringIO() | |
ascii.write(dat, out, Writer=ascii.Rdb) | |
outs = out.getvalue().splitlines() | |
> assert_equal(outs[1], 'N\tN\tS\tN') | |
test_types.py:39: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
a = 'N\tS\tS\tS', b = 'N\tN\tS\tN' | |
def assert_equal(a, b): | |
> assert a == b | |
E assert 'N\tS\tS\tS' == 'N\tN\tS\tN' | |
E - N S S S | |
E + N N S N | |
common.py:41: AssertionError | |
_______________________ test_inherit_constraints[model0] _______________________ | |
model = <CompoundModel11(amplitude_0=1.0, mean_0=0.0, stddev_0=1.0, amplitude_1=1.0, mean_1=0.0, stddev_1=1.0)> | |
@pytest.mark.parametrize('model', | |
[Gaussian1D(bounds={'stddev': (0, 0.3)}, fixed={'mean': True}) + | |
Gaussian1D(fixed={'mean': True}), | |
(_ConstraintsTestA + _ConstraintsTestB)()]) | |
def test_inherit_constraints(model): | |
""" | |
Various tests for copying of constraint values between compound models and | |
their members. | |
There are two versions of this test: One where a compound model is created | |
from two model instances, and another where a compound model is created | |
from two model classes that have default constraints set on some of their | |
parameters. | |
Regression test for https://github.com/astropy/astropy/issues/3481 | |
""" | |
# Lots of assertions in this test as there are multiple interfaces to | |
# parameter constraints | |
assert 'stddev_0' in model.bounds | |
> assert model.bounds['stddev_0'] == (0, 0.3) | |
E assert (0.1, 0.5) == (0, 0.3) | |
E At index 0 diff: 0.1 != 0 | |
E Use -v to get the full diff | |
astropy/modeling/tests/test_compound.py:759: AssertionError | |
_______________________ test_inherit_constraints[model1] _______________________ | |
model = <CompoundModel12(stddev_0=0.0, mean_0=0.0, mean_1=0.0)> | |
@pytest.mark.parametrize('model', | |
[Gaussian1D(bounds={'stddev': (0, 0.3)}, fixed={'mean': True}) + | |
Gaussian1D(fixed={'mean': True}), | |
(_ConstraintsTestA + _ConstraintsTestB)()]) | |
def test_inherit_constraints(model): | |
""" | |
Various tests for copying of constraint values between compound models and | |
their members. | |
There are two versions of this test: One where a compound model is created | |
from two model instances, and another where a compound model is created | |
from two model classes that have default constraints set on some of their | |
parameters. | |
Regression test for https://github.com/astropy/astropy/issues/3481 | |
""" | |
# Lots of assertions in this test as there are multiple interfaces to | |
# parameter constraints | |
assert 'stddev_0' in model.bounds | |
> assert model.bounds['stddev_0'] == (0, 0.3) | |
E assert (0.1, 0.5) == (0, 0.3) | |
E At index 0 diff: 0.1 != 0 | |
E Use -v to get the full diff | |
astropy/modeling/tests/test_compound.py:759: AssertionError | |
_______________________ test_grouped_item_access[False] ________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_grouped_item_access(T1): | |
""" | |
Test that column slicing preserves grouping | |
""" | |
for masked in (False, True): | |
t1 = Table(T1, masked=masked) | |
# Regular slice of a table | |
tg = t1.group_by('a') | |
tgs = tg['a', 'c', 'd'] | |
assert np.all(tgs.groups.keys == tg.groups.keys) | |
assert np.all(tgs.groups.indices == tg.groups.indices) | |
tgsa = tgs.groups.aggregate(np.sum) | |
> assert tgsa.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:241: AssertionError | |
________________________ test_grouped_item_access[True] ________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_grouped_item_access(T1): | |
""" | |
Test that column slicing preserves grouping | |
""" | |
for masked in (False, True): | |
t1 = Table(T1, masked=masked) | |
# Regular slice of a table | |
tg = t1.group_by('a') | |
tgs = tg['a', 'c', 'd'] | |
assert np.all(tgs.groups.keys == tg.groups.keys) | |
assert np.all(tgs.groups.indices == tg.groups.indices) | |
tgsa = tgs.groups.aggregate(np.sum) | |
> assert tgsa.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:241: AssertionError | |
_________________________ test_table_aggregate[False] __________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_table_aggregate(T1): | |
""" | |
Aggregate a table | |
""" | |
# Table with only summable cols | |
t1 = T1['a', 'c', 'd'] | |
tg = t1.group_by('a') | |
tga = tg.groups.aggregate(np.sum) | |
> assert tga.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:389: AssertionError | |
__________________________ test_table_aggregate[True] __________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_table_aggregate(T1): | |
""" | |
Aggregate a table | |
""" | |
# Table with only summable cols | |
t1 = T1['a', 'c', 'd'] | |
tg = t1.group_by('a') | |
tga = tg.groups.aggregate(np.sum) | |
> assert tga.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:389: AssertionError | |
_____________________ test_table_aggregate_reduceat[False] _____________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_table_aggregate_reduceat(T1): | |
""" | |
Aggregate table with functions which have a reduceat method | |
""" | |
# Comparison functions without reduceat | |
def np_mean(x): | |
return np.mean(x) | |
def np_sum(x): | |
return np.sum(x) | |
def np_add(x): | |
return np.add(x) | |
# Table with only summable cols | |
t1 = T1['a', 'c', 'd'] | |
tg = t1.group_by('a') | |
# Comparison | |
tga_r = tg.groups.aggregate(np.sum) | |
tga_a = tg.groups.aggregate(np.add) | |
tga_n = tg.groups.aggregate(np_sum) | |
assert np.all(tga_r == tga_n) | |
assert np.all(tga_a == tga_n) | |
> assert tga_n.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:471: AssertionError | |
_____________________ test_table_aggregate_reduceat[True] ______________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_table_aggregate_reduceat(T1): | |
""" | |
Aggregate table with functions which have a reduceat method | |
""" | |
# Comparison functions without reduceat | |
def np_mean(x): | |
return np.mean(x) | |
def np_sum(x): | |
return np.sum(x) | |
def np_add(x): | |
return np.add(x) | |
# Table with only summable cols | |
t1 = T1['a', 'c', 'd'] | |
tg = t1.group_by('a') | |
# Comparison | |
tga_r = tg.groups.aggregate(np.sum) | |
tga_a = tg.groups.aggregate(np.add) | |
tga_n = tg.groups.aggregate(np_sum) | |
assert np.all(tga_r == tga_n) | |
assert np.all(tga_a == tga_n) | |
> assert tga_n.pformat() == [' a c d ', | |
'--- ---- ---', | |
' 0 0.0 4', | |
' 1 6.0 18', | |
' 2 22.0 6'] | |
E assert [' a d ', '...8', ' 2 6'] == [' a c d ... 2 22.0 6'] | |
E At index 0 diff: ' a d ' != ' a c d ' | |
E Use -v to get the full diff | |
astropy/table/tests/test_groups.py:471: AssertionError | |
_________________________ test_column_aggregate[False] _________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_column_aggregate(T1): | |
""" | |
Aggregate a single table column | |
""" | |
for masked in (False, True): | |
tg = Table(T1, masked=masked).group_by('a') | |
> tga = tg['c'].groups.aggregate(np.sum) | |
astropy/table/tests/test_groups.py:507: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <ColumnGroups indices=[0 1 4 8]>, func = <ufunc 'add'> | |
def aggregate(self, func): | |
from .column import MaskedColumn | |
i0s, i1s = self.indices[:-1], self.indices[1:] | |
par_col = self.parent_column | |
masked = isinstance(par_col, MaskedColumn) | |
reduceat = hasattr(func, 'reduceat') | |
sum_case = func is np.sum | |
mean_case = func is np.mean | |
try: | |
if not masked and (reduceat or sum_case or mean_case): | |
if mean_case: | |
vals = np.add.reduceat(par_col, i0s) / np.diff(self.indices) | |
else: | |
if sum_case: | |
func = np.add | |
vals = func.reduceat(par_col, i0s) | |
else: | |
vals = np.array([func(par_col[i0: i1]) for i0, i1 in izip(i0s, i1s)]) | |
except Exception: | |
raise TypeError("Cannot aggregate column '{0}' with type '{1}'" | |
.format(par_col.info.name, | |
> par_col.info.dtype)) | |
E TypeError: Cannot aggregate column 'c' with type '<U3' | |
astropy/table/groups.py:262: TypeError | |
_________________________ test_column_aggregate[True] __________________________ | |
T1 = <Table length=8> | |
a b c d | |
int64 str1 str3 int64 | |
----- ---- ---- ----- | |
2 c 7.0 0 | |
2 b 5...6.0 2 | |
2 a 4.0 3 | |
0 a 0.0 4 | |
1 b 3.0 5 | |
1 a 2.0 6 | |
1 a 1.0 7 | |
def test_column_aggregate(T1): | |
""" | |
Aggregate a single table column | |
""" | |
for masked in (False, True): | |
tg = Table(T1, masked=masked).group_by('a') | |
> tga = tg['c'].groups.aggregate(np.sum) | |
astropy/table/tests/test_groups.py:507: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <ColumnGroups indices=[0 1 4 8]>, func = <ufunc 'add'> | |
def aggregate(self, func): | |
from .column import MaskedColumn | |
i0s, i1s = self.indices[:-1], self.indices[1:] | |
par_col = self.parent_column | |
masked = isinstance(par_col, MaskedColumn) | |
reduceat = hasattr(func, 'reduceat') | |
sum_case = func is np.sum | |
mean_case = func is np.mean | |
try: | |
if not masked and (reduceat or sum_case or mean_case): | |
if mean_case: | |
vals = np.add.reduceat(par_col, i0s) / np.diff(self.indices) | |
else: | |
if sum_case: | |
func = np.add | |
vals = func.reduceat(par_col, i0s) | |
else: | |
vals = np.array([func(par_col[i0: i1]) for i0, i1 in izip(i0s, i1s)]) | |
except Exception: | |
raise TypeError("Cannot aggregate column '{0}' with type '{1}'" | |
.format(par_col.info.name, | |
> par_col.info.dtype)) | |
E TypeError: Cannot aggregate column 'c' with type '<U3' | |
astropy/table/groups.py:262: TypeError | |
______________________________ test_table_filter _______________________________ | |
def test_table_filter(): | |
""" | |
Table groups filtering | |
""" | |
def all_positive(table, key_colnames): | |
colnames = [name for name in table.colnames if name not in key_colnames] | |
for colname in colnames: | |
if np.any(table[colname] < 0): | |
return False | |
return True | |
# Negative value in 'a' column should not filter because it is a key col | |
t = Table.read([' a c d', | |
' -2 7.0 0', | |
' -2 5.0 1', | |
' 0 0.0 4', | |
' 1 3.0 5', | |
' 1 2.0 -6', | |
' 1 1.0 7', | |
' 3 3.0 5', | |
' 3 -2.0 6', | |
' 3 1.0 7', | |
], format='ascii') | |
tg = t.group_by('a') | |
> t2 = tg.groups.filter(all_positive) | |
astropy/table/tests/test_groups.py:539: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/table/groups.py:399: in filter | |
mask[i] = func(group_table, key_colnames) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
table = <Table length=2> | |
a c d | |
int64 str4 int64 | |
----- ---- ----- | |
-2 7.0 0 | |
-2 5.0 1 | |
key_colnames = ['a'] | |
def all_positive(table, key_colnames): | |
colnames = [name for name in table.colnames if name not in key_colnames] | |
for colname in colnames: | |
> if np.any(table[colname] < 0): | |
E TypeError: unorderable types: Column() < int() | |
astropy/table/tests/test_groups.py:522: TypeError | |
______________________________ test_column_filter ______________________________ | |
def test_column_filter(): | |
""" | |
Table groups filtering | |
""" | |
def all_positive(column): | |
if np.any(column < 0): | |
return False | |
return True | |
# Negative value in 'a' column should not filter because it is a key col | |
t = Table.read([' a c d', | |
' -2 7.0 0', | |
' -2 5.0 1', | |
' 0 0.0 4', | |
' 1 3.0 5', | |
' 1 2.0 -6', | |
' 1 1.0 7', | |
' 3 3.0 5', | |
' 3 -2.0 6', | |
' 3 1.0 7', | |
], format='ascii') | |
tg = t.group_by('a') | |
> c2 = tg['c'].groups.filter(all_positive) | |
astropy/table/tests/test_groups.py:571: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/table/groups.py:301: in filter | |
mask[i] = func(group_column) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
column = <Column name='c' dtype='str4' length=2> | |
7.0 | |
5.0 | |
def all_positive(column): | |
> if np.any(column < 0): | |
E TypeError: unorderable types: Column() < int() | |
astropy/table/tests/test_groups.py:554: TypeError | |
_______________________ [doctest] astropy.time.core.Time _______________________ | |
116 A `Time` object is initialized with one or more times in the ``val`` | |
117 argument. The input times in ``val`` must conform to the specified | |
118 ``format`` and must correspond to the specified time ``scale``. The | |
119 optional ``val2`` time input should be supplied only for numeric input | |
120 formats (e.g. JD) where very high precision (better than 64-bit precision) | |
121 is required. | |
122 | |
123 The allowed values for ``format`` can be listed with:: | |
124 | |
125 >>> list(Time.FORMATS) | |
Expected: | |
['jd', 'mjd', 'decimalyear', 'unix', 'cxcsec', 'gps', 'plot_date', | |
'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str', | |
'jyear_str'] | |
Got: | |
['jd', 'mjd', 'decimalyear', 'unix', 'cxcsec', 'gps', 'plot_date', 'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str', 'jyear_str', 'longyear'] | |
/Users/bsipocz/munka/devel/astropy/astropy/time/core.py:125: DocTestFailure | |
___________________ [doctest] astropy.time.core.Time.format ____________________ | |
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example | |
??? >>> list(Time.FORMATS) | |
Expected: | |
['jd', 'mjd', 'decimalyear', 'unix', 'cxcsec', 'gps', 'plot_date', | |
'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str', | |
'jyear_str'] | |
Got: | |
['jd', 'mjd', 'decimalyear', 'unix', 'cxcsec', 'gps', 'plot_date', 'datetime', 'iso', 'isot', 'yday', 'fits', 'byear', 'jyear', 'byear_str', 'jyear_str', 'longyear'] | |
/Users/bsipocz/munka/devel/astropy/astropy/time/core.py:None: DocTestFailure | |
__________________________________ test_alias __________________________________ | |
def test_alias(): | |
from ...cosmology import core, WMAP9, WMAP7 | |
# REMOVE in astropy 0.5 | |
with catch_warnings() as w: | |
x = core.DEFAULT_COSMOLOGY() | |
> assert x == WMAP9 | |
E assert FlatLambdaCDM(name="WMAP7", H0=70.4 km / (Mpc s), Om0=0.272, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV, Ob0=0.0455) == FlatLambdaCDM(name="WMAP9", H0=69.3 km / (Mpc s), Om0=0.286, Tcmb0=2.725 K, Neff=3.04, m_nu=[ 0. 0. 0.] eV, Ob0=0.0463) | |
astropy/utils/tests/test_state.py:16: AssertionError | |
____________________________ test_db_from_registry _____________________________ | |
@remote_data | |
def test_db_from_registry(): | |
"""Test database created from VO registry. | |
.. note:: | |
We have no control of the remote registry. | |
This test just makes sure it does not crash, | |
but does not check for quality of data. | |
""" | |
from ...validator.validate import CS_MSTR_LIST | |
db = vos_catalog.VOSDatabase.from_registry( | |
> CS_MSTR_LIST(), encoding='binary', show_progress=False) | |
astropy/vo/client/tests/test_vos_catalog.py:210: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
astropy/vo/client/vos_catalog.py:547: in from_registry | |
with get_readable_fileobj(registry_url, **kwargs) as fd: | |
/sw/lib/python3.4/contextlib.py:59: in __enter__ | |
return next(self.gen) | |
astropy/utils/data.py:198: in get_readable_fileobj | |
timeout=remote_timeout) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
remote_url = 'http://vao.stsci.edu/directory/NVORegInt.asmx/VOTCapabilityPredOpt?predicate=1%3D1&capability=conesearch&VOTStyleOption=2' | |
cache = False, show_progress = False, timeout = 60.0 | |
def download_file(remote_url, cache=False, show_progress=True, timeout=None): | |
""" | |
Accepts a URL, downloads and optionally caches the result | |
returning the filename, with a name determined by the file's MD5 | |
hash. If ``cache=True`` and the file is present in the cache, just | |
returns the filename. | |
Parameters | |
---------- | |
remote_url : str | |
The URL of the file to download | |
cache : bool, optional | |
Whether to use the cache | |
show_progress : bool, optional | |
Whether to display a progress bar during the download (default | |
is `True`) | |
timeout : float, optional | |
The timeout, in seconds. Otherwise, use | |
`astropy.utils.data.Conf.remote_timeout`. | |
Returns | |
------- | |
local_path : str | |
Returns the local path that the file was download to. | |
Raises | |
------ | |
urllib2.URLError, urllib.error.URLError | |
Whenever there's a problem getting the remote file. | |
""" | |
from ..utils.console import ProgressBarOrSpinner | |
if timeout is None: | |
timeout = conf.remote_timeout | |
missing_cache = False | |
if timeout is None: | |
# use configfile default | |
timeout = REMOTE_TIMEOUT() | |
if cache: | |
try: | |
dldir, urlmapfn = _get_download_cache_locs() | |
except (IOError, OSError) as e: | |
msg = 'Remote data cache could not be accessed due to ' | |
estr = '' if len(e.args) < 1 else (': ' + str(e)) | |
warn(CacheMissingWarning(msg + e.__class__.__name__ + estr)) | |
cache = False | |
missing_cache = True # indicates that the cache is missing to raise a warning later | |
if six.PY2 and isinstance(remote_url, six.text_type): | |
# shelve DBs don't accept unicode strings in Python 2 | |
url_key = remote_url.encode('utf-8') | |
else: | |
url_key = remote_url | |
try: | |
if cache: | |
# We don't need to acquire the lock here, since we are only reading | |
with _open_shelve(urlmapfn, True) as url2hash: | |
if url_key in url2hash: | |
return url2hash[url_key] | |
with contextlib.closing(urllib.request.urlopen( | |
remote_url, timeout=timeout)) as remote: | |
#keep a hash to rename the local file to the hashed name | |
hash = hashlib.md5() | |
info = remote.info() | |
if 'Content-Length' in info: | |
try: | |
size = int(info['Content-Length']) | |
except ValueError: | |
size = None | |
else: | |
size = None | |
if size is not None: | |
check_free_space_in_dir(gettempdir(), size) | |
if cache: | |
check_free_space_in_dir(dldir, size) | |
if show_progress: | |
progress_stream = sys.stdout | |
else: | |
progress_stream = io.StringIO() | |
dlmsg = "Downloading {0}".format(remote_url) | |
with ProgressBarOrSpinner(size, dlmsg, file=progress_stream) as p: | |
with NamedTemporaryFile(delete=False) as f: | |
try: | |
bytes_read = 0 | |
block = remote.read(conf.download_block_size) | |
while block: | |
f.write(block) | |
hash.update(block) | |
bytes_read += len(block) | |
p.update(bytes_read) | |
block = remote.read(conf.download_block_size) | |
except: | |
if os.path.exists(f.name): | |
os.remove(f.name) | |
raise | |
if cache: | |
_acquire_download_cache_lock() | |
try: | |
with _open_shelve(urlmapfn, True) as url2hash: | |
# We check now to see if another process has | |
# inadvertently written the file underneath us | |
# already | |
if url_key in url2hash: | |
return url2hash[url_key] | |
local_path = os.path.join(dldir, hash.hexdigest()) | |
shutil.move(f.name, local_path) | |
url2hash[url_key] = local_path | |
finally: | |
_release_download_cache_lock() | |
else: | |
local_path = f.name | |
if missing_cache: | |
msg = ('File downloaded to temporary location due to problem ' | |
'with cache directory and will not be cached.') | |
warn(CacheMissingWarning(msg, local_path)) | |
if conf.delete_temporary_downloads_at_exit: | |
global _tempfilestodel | |
_tempfilestodel.append(local_path) | |
except urllib.error.URLError as e: | |
if hasattr(e, 'reason') and hasattr(e.reason, 'errno') and e.reason.errno == 8: | |
e.reason.strerror = e.reason.strerror + '. requested URL: ' + remote_url | |
e.reason.args = (e.reason.errno, e.reason.strerror) | |
raise e | |
except socket.timeout as e: | |
# this isn't supposed to happen, but occasionally a socket.timeout gets | |
# through. It's supposed to be caught in `urrlib2` and raised in this | |
# way, but for some reason in mysterious circumstances it doesn't. So | |
# we'll just re-raise it here instead | |
> raise urllib.error.URLError(e) | |
E urllib.error.URLError: <urlopen error timed out> | |
astropy/utils/data.py:1104: URLError | |
29 failed, 7082 passed, 150 skipped, 23 xfailed, 2 xpassed, 2 error in 612.72 seconds | |
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'> | |
/Users/bsipocz/.virtualenvs/astropy-dev/lib/python3.4/importlib/_bootstrap.py:2150: ImportWarning: sys.meta_path is empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment