{"action":"opened","issue":{"url":"https://api.github.com/repos/gammapy/gammapy/issues/1380","repository_url":"https://api.github.com/repos/gammapy/gammapy","labels_url":"https://api.github.com/repos/gammapy/gammapy/issues/1380/labels{/name}","comments_url":"https://api.github.com/repos/gammapy/gammapy/issues/1380/comments","events_url":"https://api.github.com/repos/gammapy/gammapy/issues/1380/events","html_url":"https://github.com/gammapy/gammapy/issues/1380","id":314943841,"number":1380,"title":"Change test with assert_quantity_allclose to explicit unit checks","user":{"login":"cdeil","id":852409,"avatar_url":"https://avatars3.githubusercontent.com/u/852409?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"labels":[{"id":81671553,"url":"https://api.github.com/repos/gammapy/gammapy/labels/astropy","name":"astropy","color":"eb6420","default":false},{"id":81671214,"url":"https://api.github.com/repos/gammapy/gammapy/labels/tests","name":"tests","color":"009800","default":false}],"state":"open","locked":false,"assignee":{"login":"cdeil","id":852409,"avatar_url":"https://avatars3.githubusercontent.com/u/852409?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"assignees":[{"login":"cdeil","id":852409,"avatar_url":"https://avatars3.githubusercontent.com/u/852409?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/gammapy/gammapy/milestones/11","html_url":"https://github.com/gammapy/gammapy/milestone/11","labels_url":"https://api.github.com/repos/gammapy/gammapy/milestones/11/labels","id":2487784,"number":11,"title":"0.8","description":"","creator":{"login":"cdeil","id":852409,"avatar_url":"https://avatars3.githubusercontent.com/u/852409?v=4","gravatar_id":"","url":"https://api.github.com/users/cdeil","html_url":"https://github.com/cdeil","followers_url":"https://api.github.com/users/cdeil/followers","following_url":"https://api.github.com/users/cdeil/following{/other_user}","gists_url":"https://api.github.com/users/cdeil/gists{/gist_id}","starred_url":"https://api.github.com/users/cdeil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdeil/subscriptions","organizations_url":"https://api.github.com/users/cdeil/orgs","repos_url":"https://api.github.com/users/cdeil/repos","events_url":"https://api.github.com/users/cdeil/events{/privacy}","received_events_url":"https://api.github.com/users/cdeil/received_events","type":"User","site_admin":false},"open_issues":173,"closed_issues":55,"state":"open","created_at":"2017-04-28T09:17:03Z","updated_at":"2018-04-17T07:50:50Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-04-17T07:50:49Z","updated_at":"2018-04-17T07:50:49Z","closed_at":null,"author_association":"OWNER","body":"A change in Astropy master from yesterday (https://github.com/astropy/astropy/pull/7252#issuecomment-381882939) broke some of our tests (https://travis-ci.org/gammapy/gammapy/jobs/367497442#L3786)\r\n\r\nThe error message is now no longer useful if the quantities are different:\r\n```\r\n>>> from astropy.tests.helper import assert_quantity_allclose\r\n>>> import astropy.units as u\r\n>>> assert_quantity_allclose(42 * u.m, 44 * u.m)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/deil/Library/Python/3.6/lib/python/site-packages/astropy/tests/helper.py\", line 466, in assert_quantity_allclose\r\n    assert _quantity_allclose(actual, desired, rtol=rtol, atol=atol, **kwargs)\r\nAssertionError\r\n```\r\n\r\nBut I never liked `assert_quantity_allclose` anyways, because it passes if quantity value and unit change, but the quantity is the same:\r\n```\r\n>>> assert_quantity_allclose(42 * u.m, 4200 * u.cm)\r\n```\r\nUnits shouldn't change without good reason and code changes, so I prefer to explicitly check value and unit, using `numpy.testing.assert_allclose` for the data and a separate assert statement for the unit. It's one extra line, and we could introduce our own helper function for that. But for now, I'll just change to have these two lines."}}
{"actor":{"display_login":"cdeil"}}