Skip to content

TST: test_highlevel_api_remote failed with TypeError #10297

Closed

Description

@pllim

Example log: https://travis-ci.org/github/astropy/astropy/jobs/683016071

__________________________ test_highlevel_api_remote ___________________________
    @pytest.mark.remote_data
    def test_highlevel_api_remote():
        m31icrs = coords.SkyCoord.from_name('M31', frame='icrs')
    
        m31str = str(m31icrs)
        assert m31str.startswith('<SkyCoord (ICRS): (ra, dec) in deg\n    (')
        assert m31str.endswith(')>')
        assert '10.68' in m31str
        assert '41.26' in m31str
        # The above is essentially a replacement of the below, but tweaked so that
        # small/moderate changes in what `from_name` returns don't cause the tests
        # to fail
        # assert str(m31icrs) == '<SkyCoord (ICRS): (ra, dec) in deg\n    (10.6847083, 41.26875)>'
    
        m31fk4 = coords.SkyCoord.from_name('M31', frame='fk4')
    
>       assert m31icrs.frame != m31fk4.frame
../../.tox/py37-test-devdeps/lib/python3.7/site-packages/astropy/coordinates/tests/test_api_ape5.py:447: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../.tox/py37-test-devdeps/lib/python3.7/site-packages/astropy/coordinates/baseframe.py:1669: in __ne__
    return np.logical_not(self == value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
self = <ICRS Coordinate: (ra, dec) in deg
    (10.68470833, 41.26875)>
value = <FK4 Coordinate (equinox=B1950.000, obstime=B1950.000): (ra, dec) in deg
    (10.00039635, 40.99492542)>
    def __eq__(self, value):
        """Equality operator for frame.
    
        This implements strict equality and requires that the frames are
        equivalent and that the representation data are exactly equal.
        """
        is_equiv = self.is_equivalent_frame(value)
    
        if self._data is None and value._data is None:
            # For Frame with no data, == compare is same as is_equivalent_frame()
            return is_equiv
    
        if not is_equiv:
>           raise TypeError(f'cannot compare: objects must have equivalent frames: '
                            f'{self.replicate_without_data()} vs. '
                            f'{value.replicate_without_data()}')
E           TypeError: cannot compare: objects must have equivalent frames: <ICRS Frame> vs. <FK4 Frame (equinox=B1950.000, obstime=B1950.000)>
../../.tox/py37-test-devdeps/lib/python3.7/site-packages/astropy/coordinates/baseframe.py:1657: TypeError

A lot of PRs have been merged in the last few days, so I am not sure which one introduced this.

cc @eteq @adrn @mhvk @taldcroft

Activity

  1. added this to the v4.1 milestone on May 4, 2020
  2. pllim commented on May 4, 2020

    @pllim
    MemberAuthor

    Maybe #10154 ?

  3. ayshih commented on May 4, 2020

    @ayshih
    Contributor

    Yup, #10154 would be the cause. Now that #10290 has been merged, the fix is straightforward: change that line to assert not m31icrs.is_equivalent_frame(m31fk4).

  4. pllim commented on May 4, 2020

    @pllim
    MemberAuthor

    @ayshih , are you planning to submit a PR? Thanks!

  5. ayshih commented on May 4, 2020

    @ayshih
    Contributor

    Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions