Skip to content

Change representation arithmetic tests to be n-d - #5441

Closed
eteq wants to merge 1 commit into
astropy:masterfrom
eteq:test-nd-repr-arithmetic
Closed

eteq wants to merge 1 commit into
astropy:masterfrom
eteq:test-nd-repr-arithmetic

Conversation

@eteq

@eteq eteq commented Oct 28, 2016

Copy link
Copy Markdown
Member

This changes the tests for the arithmetic added in #5301 to be 2D for everything. This is currently erroring on my local machine, so initially this PR is just a test to see if that holds up for travis (as @mhvk reported not seeing these errors).

If travis passes this can probably be closed, although I might end up editing it into a more thorough regression test. On the other hand, if travis fails like I see locally, this is a bug report 😉.

@mhvk

mhvk commented Oct 28, 2016

Copy link
Copy Markdown
Contributor

OK, now I see the problem: the broadcasting really is going wrong because the tests assume the input is 1-dimensional. E.g., one has to replace [::-1] with [:, ::-1] at https://github.com/eteq/astropy/blob/deff32f13f803b30ad4ba1f6848cdd16506d9a6d/astropy/coordinates/tests/test_representation_arithmetic.py#L281 and add an additional np.newaxis in https://github.com/eteq/astropy/blob/deff32f13f803b30ad4ba1f6848cdd16506d9a6d/astropy/coordinates/tests/test_representation_arithmetic.py#L326.

I haven't checked everything (too late here in the UK), but my hope now is that this is a red herring.

@astrofrog

Copy link
Copy Markdown
Member

Would it make sense to parametrize the tests to make sure they run in say 1, 2, and 3D?

@mhvk

mhvk commented Oct 29, 2016

Copy link
Copy Markdown
Contributor

@astrofrog - in principle, one could add higher-D, but even with my 1-D example there are already 2-D tests, and I don't do anything fancy, so my feeling is that this was really a red herring due to @eteq not having looked quite carefully enough where in the tests assumptions were made about dimensionality, and that thus we'd just be checking numpy broadcasting...

@eteq

eteq commented Oct 31, 2016

Copy link
Copy Markdown
Member Author

@mhvk - I think we do want to have actual tests that are n-D, because even if the current functionality is fine, future additions may not be. I know that's where almost all the problems that have sneaked into releases have come from (i.e., it works in 1d but not n-d).

I'll try re-working this branch to parameterize the tests to work in different dimensions.

@mhvk

mhvk commented Oct 31, 2016

Copy link
Copy Markdown
Contributor

@eteq - it be better off checking that things work at a higher level, e.g., using the example mentioned in #5364. (Indeed, this was something I had meant to do for this whole series -- first at least make it possible to do multi-d properly, and then shake out any remaining bugs by adding multi-D examples to the transformation chain.) But obviously it is not like it hurts to do it here too! It just will need a bit of thought (I would actually recommend just adding a few explicit multi-d tests rather than parametrize, but it is obviously up to you).

@adrn

adrn commented Sep 20, 2017

Copy link
Copy Markdown
Member

I'd like to revisit the test organization and coverage in astropy coordinates, and with that I think it does make sense to have fixtures that test scalar, 1d, and nd arrays in some contexts. So, I'd suggest closing this PR and deferring to #6577

@pllim pllim added the Close? Tell stale bot that this issue/PR is stale label Sep 20, 2017
@bsipocz

bsipocz commented Sep 21, 2017

Copy link
Copy Markdown
Member

Based on the seeming agreement on @adrn's suggestion above, I'm closing this. Please reopen if I misunderstood.

@bsipocz bsipocz closed this Sep 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Close? Tell stale bot that this issue/PR is stale coordinates testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants