Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bsipocz/eef164a9a31acfeb965b to your computer and use it in GitHub Desktop.
Save bsipocz/eef164a9a31acfeb965b to your computer and use it in GitHub Desktop.
============================= test session starts ==============================
platform darwin -- Python 3.4.3 -- py-1.4.30 -- pytest-2.7.3
rootdir: /Users/bsipocz/.local/lib/python3.4/site-packages/astropy, inifile:
Running tests with Astropy version 1.1rc1.
Running tests in /Users/bsipocz/.local/lib/python3.4/site-packages/astropy.
Date: 2015-11-24T22:49:06
Platform: Darwin-14.5.0-x86_64-i386-64bit
Executable: /sw/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.
collected 7049 items / 2 errors
../../../../.local/lib/python3.4/site-packages/astropy/_erfa/tests/test_erfa.py .....
../../../../.local/lib/python3.4/site-packages/astropy/analytic_functions/tests/test_blackbody.py .....
../../../../.local/lib/python3.4/site-packages/astropy/config/tests/test_configs.py .................
../../../../.local/lib/python3.4/site-packages/astropy/constants/tests/test_constant.py ........
../../../../.local/lib/python3.4/site-packages/astropy/constants/tests/test_pickle.py sss
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_convolve.py ...............................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_convolve_fft.py ...................................................................................................................................................................................................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_convolve_kernels.py ..............................................................................
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_discretize.py ...s...........s...............
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_kernel_class.py ........................................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/convolution/tests/test_pickle.py .xx.xx.xx
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_angles.py ........................................
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_angular_separation.py ....
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_api_ape5.py .....
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_arrays.py .............
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_celestial_transformations.py ..........
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_distance.py .F.......
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_earth.py .............
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_formatting.py ..........
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_frames.py ......................F.
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_funcs.py ...
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_iau_fullstack.py ....................................................
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_intermediate_transformations.py ...................................................
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_matching.py ......
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_name_resolve.py F..
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_pickle.py ..sss
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_regression.py .......
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_representation.py .............................................................................
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_sites.py .......
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_sky_coord.py ........................................................................................................................................................................................................................................................................................................................................................................................x.................
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_transformations.py ......
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/test_unit_representation.py .
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_altaz_icrs.py ...x
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_ecliptic.py ...
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.py .
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py .
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_galactic_fk4.py .
../../../../.local/lib/python3.4/site-packages/astropy/coordinates/tests/accuracy/test_icrs_fk5.py .
../../../../.local/lib/python3.4/site-packages/astropy/cosmology/tests/test_cosmology.py .....................................
../../../../.local/lib/python3.4/site-packages/astropy/cosmology/tests/test_pickle.py sss
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py .................FF........x.........FF.......x.....FFx.x...............FF
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_cds_header_from_readme.py ...
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_compressed.py .......
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_connect.py .............ss........
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_ecsv.py .......
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_fixedwidth.py ...............................
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_html.py s.ssssss.ssss..s
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_ipac_definitions.py ....................
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_read.py ...............................................................................................F.........
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_types.py .F.
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_write.py ...............
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_checksum.py .....................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_connect.py ..........................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_core.py .................................................ss..........
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_diff.py ...................................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_division.py .....
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_groups.py ........
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_hdulist.py .........................................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_header.py ................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_image.py ......................................................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_nonstandard.py ...
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_structured.py .
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_table.py .................................x.....................................
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_uint.py ........
../../../../.local/lib/python3.4/site-packages/astropy/io/fits/tests/test_util.py .
../../../../.local/lib/python3.4/site-packages/astropy/io/misc/tests/test_hdf5.py sssssssssssssssssssssssssssssssssssssssss
../../../../.local/lib/python3.4/site-packages/astropy/io/misc/tests/test_pickle_helpers.py ....
../../../../.local/lib/python3.4/site-packages/astropy/io/tests/test_registry.py ..............................
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/converter_test.py ......................
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/exception_test.py ..
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/table_test.py ........
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/tree_test.py ...
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/ucd_test.py .....
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/util_test.py ...........
../../../../.local/lib/python3.4/site-packages/astropy/io/votable/tests/vo_test.py .........................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_compound.py ..........................................FF........s
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_constraints.py .....................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_core.py .............
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_fitters.py ...................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_functional_models.py ...........
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_input.py ......................................................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_mappings.py ......
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_models.py .................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_parameters.py ....................................................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_polynomial.py ............................s.........
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_projections.py .......................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_rotations.py .............
../../../../.local/lib/python3.4/site-packages/astropy/modeling/tests/test_utils.py ...
../../../../.local/lib/python3.4/site-packages/astropy/nddata/mixins/tests/test_ndarithmetic.py ........................................................
../../../../.local/lib/python3.4/site-packages/astropy/nddata/mixins/tests/test_ndio.py .
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_compat.py ................
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_decorators.py ..........
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_flag_collection.py ..........
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_nddata.py ..................................
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_nddata_base.py .
../../../../.local/lib/python3.4/site-packages/astropy/nddata/tests/test_utils.py ....................s...........................
../../../../.local/lib/python3.4/site-packages/astropy/stats/tests/test_bayesian_blocks.py .......
../../../../.local/lib/python3.4/site-packages/astropy/stats/tests/test_funcs.py .................................
../../../../.local/lib/python3.4/site-packages/astropy/stats/tests/test_histogram.py .........
../../../../.local/lib/python3.4/site-packages/astropy/stats/tests/test_sigma_clipping.py .....
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_array.py ...
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_bst.py .......
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_column.py ...................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_groups.py ....................FF........FFFFFFFF
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_index.py ................................................................................................................................................................................................................................................................................................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_info.py ............
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_init_table.py ...................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_item_access.py ..............................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_jsviewer.py ...
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_masked.py ..................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_mixin.py ..............................................................x....
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_np_utils.py .
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_operations.py ......................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_pickle.py ...............
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_pprint.py ........................................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_row.py ..................................
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_subclass.py ..
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_table.py ................................................................................................................................................................................................................................................................................................x........................................
../../../../.local/lib/python3.4/site-packages/astropy/tests/test_logger.py .............................
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_imports.py ..
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_open_file_detection.py .
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_quantity_helpers.py .
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_run_tests.py ....
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_skip_remote_data.py .
../../../../.local/lib/python3.4/site-packages/astropy/tests/tests/test_socketblocker.py ....
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_basic.py .......................................................
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_comparisons.py ...
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_delta.py .................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_guess.py ....
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_methods.py ..........ss.......
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_pickle.py .
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_precision.py .......x..
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_quantity_interaction.py ...............
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_sidereal.py ...................
../../../../.local/lib/python3.4/site-packages/astropy/time/tests/test_ut1.py ...s
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_equivalencies.py .....................................................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_format.py .................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_logarithmic.py .s...ss.s...s................ss.............................................................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_physical.py ...........
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_quantity.py ......................................................................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_quantity_array_methods.py .............................x............x.x.............
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_quantity_decorator.py ............................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_quantity_non_ufuncs.py xx
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_quantity_ufuncs.py ..........................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/units/tests/test_units.py ............................................................................................................................................................................................................................................................................................................................................................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/utils/compat/numpy/tests/test_broadcast_arrays.py ....
../../../../.local/lib/python3.4/site-packages/astropy/utils/iers/tests/test_iers.py ....s
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_codegen.py .
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_collections.py .....
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_compat.py .
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_console.py .......s.................
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_data.py ..........................
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_data_info.py .............
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_decorators.py ........s..
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_gzip.py ..
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_introspection.py ....
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_metadata.py ...............
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_misc.py .....
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_odict.py sssssssssssssssssssssssssssssssssssssssssss
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_state.py F.
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_timer.py .
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_xml.py ........
../../../../.local/lib/python3.4/site-packages/astropy/visualization/scripts/tests/test_fits2bitmap.py ..
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_histogram.py ...
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_interval.py .................
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_norm.py s......
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_stretch.py ...................................................................................................
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_ui.py ......
../../../../.local/lib/python3.4/site-packages/astropy/visualization/tests/test_units.py ..
../../../../.local/lib/python3.4/site-packages/astropy/vo/client/tests/test_conesearch.py .................x.
../../../../.local/lib/python3.4/site-packages/astropy/vo/client/tests/test_vos_catalog.py ...............
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_client.py ....
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_errors.py ...
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_hub.py ..
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_hub_proxy.py .....
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_hub_script.py .
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_standard_profile.py ...
../../../../.local/lib/python3.4/site-packages/astropy/vo/samp/tests/test_web_profile.py ..
../../../../.local/lib/python3.4/site-packages/astropy/vo/validator/tests/test_inpect.py ....
../../../../.local/lib/python3.4/site-packages/astropy/vo/validator/tests/test_validate.py ....
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/test_pickle.py ......
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/test_profiling.py ..................................
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/test_utils.py .........................................
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/test_wcs.py ..........................................................................
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/test_wcsprm.py ...........................................................................................................XX..
../../../../.local/lib/python3.4/site-packages/astropy/wcs/tests/extension/test_extension.py .
==================================== ERRORS ====================================
________________ ERROR collecting modeling/tests/test_models.py ________________
_pytest.runner:149: in __init__
???
_pytest.main:437: in _memocollect
???
_pytest.main:314: in _memoizedcall
???
_pytest.main:437: in <lambda>
???
_pytest.python:573: in collect
???
_pytest.python:365: in collect
???
_pytest.python:377: in makeitem
???
_pytest.core:521: in __call__
???
_pytest.core:528: in _docall
???
_pytest.core:393: in execute
???
_pytest.core:109: in wrapped_call
???
_pytest.python:255: in pytest_pycollect_makeitem
???
_pytest.python:394: in _genfunctions
???
_pytest.core:524: in callextra
???
_pytest.core:528: in _docall
???
_pytest.core:394: in execute
???
_pytest.python:164: in pytest_generate_tests
???
_pytest.python:879: in parametrize
???
_pytest.python:752: in setmulti
???
_pytest.python:735: in _checkargnotcontained
???
E ValueError: duplicate 'model_class'
________________ ERROR collecting modeling/tests/test_models.py ________________
_pytest.runner:149: in __init__
???
_pytest.main:437: in _memocollect
???
_pytest.main:314: in _memoizedcall
???
_pytest.main:437: in <lambda>
???
_pytest.python:573: in collect
???
_pytest.python:365: in collect
???
_pytest.python:377: in makeitem
???
_pytest.core:521: in __call__
???
_pytest.core:528: in _docall
???
_pytest.core:393: in execute
???
_pytest.core:109: in wrapped_call
???
_pytest.python:255: in pytest_pycollect_makeitem
???
_pytest.python:394: in _genfunctions
???
_pytest.core:524: in callextra
???
_pytest.core:528: in _docall
???
_pytest.core:394: in execute
???
_pytest.python:164: in pytest_generate_tests
???
_pytest.python:879: in parametrize
???
_pytest.python:752: in setmulti
???
_pytest.python:735: in _checkargnotcontained
???
E ValueError: duplicate 'model_class'
=================================== 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)
../../../../.local/lib/python3.4/site-packages/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 0x1192eff28>
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):
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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)
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)
../../../../.local/lib/python3.4/site-packages/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
____________________________ test_conversion[True] _____________________________
parallel = True
read_basic = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_conversion_True_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>, format='basic')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:248:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/common.py:41: AssertionError
____________________________ test_conversion[False] ____________________________
parallel = False
read_basic = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_conversion_False_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>, format='basic')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:248:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/common.py:41: AssertionError
____________________________ test_fill_values[True] ____________________________
parallel = True
read_basic = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_fill_values_True_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>, format='basic')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:487:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/common.py:41: AssertionError
___________________________ test_fill_values[False] ____________________________
parallel = False
read_basic = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_fill_values_False_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastBasic'>, format='basic')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:487:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/common.py:41: AssertionError
________________________________ test_rdb[True] ________________________________
parallel = True
read_rdb = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_rdb_True_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastRdb'>, format='rdb')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:682:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:58: in _read
t1 = reader.read(table)
../../../../.local/lib/python3.4/site-packages/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)
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
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 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_rdb_False_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastRdb'>, format='rdb')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:682:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:58: in _read
t1 = reader.read(table)
../../../../.local/lib/python3.4/site-packages/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)
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
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 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_fast_tab_with_names_True_0'), Reader=<class 'astropy.io.ascii.fastbasic.FastTab'>, format='tab')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:890:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/common.py:41: AssertionError
_______________________ test_fast_tab_with_names[False] ________________________
parallel = False
read_tab = functools.partial(<function _read at 0x11551eae8>, local('/private/var/folders/dc/hsm7tqpx2d57n7vb3k1l81xw0000gq/T/pytest-bsipocz/pytest-2/test_fast_tab_with_names_False0'), Reader=<class 'astropy.io.ascii.fastbasic.FastTab'>, format='tab')
@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)
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:890:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/astropy/io/ascii/tests/test_c_reader.py:66: in _read
assert_table_equal(t4, t5, check_meta=check_meta)
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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 0x10fdc8510>(<Column name=...h=2>\n1.11\n 4.0 == <Column name='...h=2>\n1.11\n 4.0
E + where <function all at 0x10fdc8510> = 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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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
../../../../.local/lib/python3.4/site-packages/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)
../../../../.local/lib/python3.4/site-packages/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'
../../../../.local/lib/python3.4/site-packages/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)
../../../../.local/lib/python3.4/site-packages/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'
../../../../.local/lib/python3.4/site-packages/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)
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_groups.py:539:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/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()
../../../../.local/lib/python3.4/site-packages/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)
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_groups.py:571:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../.local/lib/python3.4/site-packages/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()
../../../../.local/lib/python3.4/site-packages/astropy/table/tests/test_groups.py:554: TypeError
__________________________________ 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)
../../../../.local/lib/python3.4/site-packages/astropy/utils/tests/test_state.py:16: AssertionError
26 failed, 6871 passed, 128 skipped, 22 xfailed, 2 xpassed, 2 error in 800.17 seconds
1
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment