{"action":"created","comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/23029396","id":23029396,"diff_hunk":"@@ -0,0 +1,61 @@\n+# Licensed under a 3-clause BSD style license - see LICENSE.rst\n+\n+from __future__ import (absolute_import, unicode_literals, division,\n+                        print_function)\n+from ...tests.helper import pytest\n+from ..models import Shift, Rotation2D, Identity, Mapping\n+import numpy as np\n+from numpy.testing.utils import (assert_allclose, assert_array_equal)\n+\n+\n+x = np.zeros((2, 3))\n+y = np.ones((2, 3))\n+\n+\n+def test_swap_axes():\n+    mapping = Mapping((1, 0))\n+    assert(mapping(1, 2) == (2.0, 1.0))\n+    assert(mapping.inverse(2, 1) == (1, 2))\n+    assert_array_equal(mapping(x, y), (y, x))\n+    assert_array_equal(mapping.inverse(y, x), (x, y))\n+\n+\n+def test_duplicate_axes():\n+    mapping = Mapping((0, 1, 0, 1))\n+    assert(mapping(1, 2) == (1.0, 2., 1., 2))\n+    assert(mapping.inverse(1, 2, 1, 2) == (1, 2))\n+    assert(mapping.inverse.n_inputs == 4)\n+    assert(mapping.inverse.n_outputs == 2)\n+\n+\n+def test_drop_axes_1():\n+    mapping = Mapping((0, ))\n+    assert(mapping(1, 2) == (1.))\n+    assert(mapping.inverse(1) == 1)\n+\n+\n+def test_drop_axes_2():\n+    mapping = Mapping((1, ))\n+    assert(mapping(1, 2) == (2.))\n+    with pytest.raises(NotImplementedError):\n+        mapping.inverse\n+\n+\n+def test_identity():\n+    ident1 = Identity(1)\n+    shift = Shift(1)\n+    rotation = Rotation2D(angle=60)\n+    model = ident1 & shift | rotation\n+    assert(model(1, 2) == (-2.098076211353316, 2.3660254037844393))\n+    res_x, res_y = model(x, y)\n+    assert_allclose((res_x, res_y),\n+                       (np.array([[-1.73205081, -1.73205081, -1.73205081],\n+                                  [-1.73205081, -1.73205081, -1.73205081]]),\n+                        np.array([[ 1.,  1.,  1.],\n+                                  [ 1.,  1.,  1.]])))\n+    assert_allclose(model.inverse(res_x, res_y), (x, y))\n+\n+\n+def test_name():","path":"astropy/modeling/tests/test_mappings.py","position":59,"original_position":59,"commit_id":"ab8e7a21b768c7b2551f482c6ae6386beba30888","original_commit_id":"ab8e7a21b768c7b2551f482c6ae6386beba30888","user":{"login":"embray","id":676149,"avatar_url":"https://avatars.githubusercontent.com/u/676149?v=3","gravatar_id":"","url":"https://api.github.com/users/embray","html_url":"https://github.com/embray","followers_url":"https://api.github.com/users/embray/followers","following_url":"https://api.github.com/users/embray/following{/other_user}","gists_url":"https://api.github.com/users/embray/gists{/gist_id}","starred_url":"https://api.github.com/users/embray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/embray/subscriptions","organizations_url":"https://api.github.com/users/embray/orgs","repos_url":"https://api.github.com/users/embray/repos","events_url":"https://api.github.com/users/embray/events{/privacy}","received_events_url":"https://api.github.com/users/embray/received_events","type":"User","site_admin":false},"body":"I think this test is unnecessary.","created_at":"2015-01-15T18:07:27Z","updated_at":"2015-01-15T18:07:27Z","html_url":"https://github.com/astropy/astropy/pull/3300#discussion_r23029396","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/3300","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/23029396"},"html":{"href":"https://github.com/astropy/astropy/pull/3300#discussion_r23029396"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3300"}}},"pull_request":{"url":"https://api.github.com/repos/astropy/astropy/pulls/3300","id":27441924,"html_url":"https://github.com/astropy/astropy/pull/3300","diff_url":"https://github.com/astropy/astropy/pull/3300.diff","patch_url":"https://github.com/astropy/astropy/pull/3300.patch","issue_url":"https://api.github.com/repos/astropy/astropy/issues/3300","number":3300,"state":"open","locked":false,"title":"Add docstrings, name and __repr__ to mappings","user":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","gravatar_id":"","url":"https://api.github.com/users/nden","html_url":"https://github.com/nden","followers_url":"https://api.github.com/users/nden/followers","following_url":"https://api.github.com/users/nden/following{/other_user}","gists_url":"https://api.github.com/users/nden/gists{/gist_id}","starred_url":"https://api.github.com/users/nden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nden/subscriptions","organizations_url":"https://api.github.com/users/nden/orgs","repos_url":"https://api.github.com/users/nden/repos","events_url":"https://api.github.com/users/nden/events{/privacy}","received_events_url":"https://api.github.com/users/nden/received_events","type":"User","site_admin":false},"body":"This PR is based on #3297 which should be merged first.","created_at":"2015-01-15T16:36:12Z","updated_at":"2015-01-15T18:07:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2762f7e94548cd237b23fc3b434359e7764c4078","assignee":null,"milestone":{"url":"https://api.github.com/repos/astropy/astropy/milestones/15","labels_url":"https://api.github.com/repos/astropy/astropy/milestones/15/labels","id":643887,"number":15,"title":"v1.0.0","description":"","creator":{"login":"astrofrog","id":314716,"avatar_url":"https://avatars.githubusercontent.com/u/314716?v=3","gravatar_id":"","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"open_issues":27,"closed_issues":188,"state":"open","created_at":"2014-04-29T16:03:02Z","updated_at":"2015-01-15T16:36:26Z","due_on":"2015-01-23T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/astropy/astropy/pulls/3300/commits","review_comments_url":"https://api.github.com/repos/astropy/astropy/pulls/3300/comments","review_comment_url":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/astropy/astropy/issues/3300/comments","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/ab8e7a21b768c7b2551f482c6ae6386beba30888","head":{"label":"nden:mappings-name","ref":"mappings-name","sha":"ab8e7a21b768c7b2551f482c6ae6386beba30888","user":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","gravatar_id":"","url":"https://api.github.com/users/nden","html_url":"https://github.com/nden","followers_url":"https://api.github.com/users/nden/followers","following_url":"https://api.github.com/users/nden/following{/other_user}","gists_url":"https://api.github.com/users/nden/gists{/gist_id}","starred_url":"https://api.github.com/users/nden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nden/subscriptions","organizations_url":"https://api.github.com/users/nden/orgs","repos_url":"https://api.github.com/users/nden/repos","events_url":"https://api.github.com/users/nden/events{/privacy}","received_events_url":"https://api.github.com/users/nden/received_events","type":"User","site_admin":false},"repo":{"id":6738136,"name":"astropy","full_name":"nden/astropy","owner":{"login":"nden","id":1110361,"avatar_url":"https://avatars.githubusercontent.com/u/1110361?v=3","gravatar_id":"","url":"https://api.github.com/users/nden","html_url":"https://github.com/nden","followers_url":"https://api.github.com/users/nden/followers","following_url":"https://api.github.com/users/nden/following{/other_user}","gists_url":"https://api.github.com/users/nden/gists{/gist_id}","starred_url":"https://api.github.com/users/nden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nden/subscriptions","organizations_url":"https://api.github.com/users/nden/orgs","repos_url":"https://api.github.com/users/nden/repos","events_url":"https://api.github.com/users/nden/events{/privacy}","received_events_url":"https://api.github.com/users/nden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nden/astropy","description":"Main AstroPy repository","fork":true,"url":"https://api.github.com/repos/nden/astropy","forks_url":"https://api.github.com/repos/nden/astropy/forks","keys_url":"https://api.github.com/repos/nden/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nden/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nden/astropy/teams","hooks_url":"https://api.github.com/repos/nden/astropy/hooks","issue_events_url":"https://api.github.com/repos/nden/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/nden/astropy/events","assignees_url":"https://api.github.com/repos/nden/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/nden/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/nden/astropy/tags","blobs_url":"https://api.github.com/repos/nden/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nden/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nden/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/nden/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nden/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/nden/astropy/languages","stargazers_url":"https://api.github.com/repos/nden/astropy/stargazers","contributors_url":"https://api.github.com/repos/nden/astropy/contributors","subscribers_url":"https://api.github.com/repos/nden/astropy/subscribers","subscription_url":"https://api.github.com/repos/nden/astropy/subscription","commits_url":"https://api.github.com/repos/nden/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/nden/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/nden/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/nden/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/nden/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/nden/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nden/astropy/merges","archive_url":"https://api.github.com/repos/nden/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nden/astropy/downloads","issues_url":"https://api.github.com/repos/nden/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/nden/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/nden/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/nden/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nden/astropy/labels{/name}","releases_url":"https://api.github.com/repos/nden/astropy/releases{/id}","created_at":"2012-11-17T18:06:04Z","updated_at":"2014-06-06T19:38:34Z","pushed_at":"2015-01-15T16:32:25Z","git_url":"git://github.com/nden/astropy.git","ssh_url":"git@github.com:nden/astropy.git","clone_url":"https://github.com/nden/astropy.git","svn_url":"https://github.com/nden/astropy","homepage":"astropy.org","size":31144,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"astropy:master","ref":"master","sha":"98969ff9cc8fbba2fa30567052b16a8e388fd106","user":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"repo":{"id":2081289,"name":"astropy","full_name":"astropy/astropy","owner":{"login":"astropy","id":847984,"avatar_url":"https://avatars.githubusercontent.com/u/847984?v=3","gravatar_id":"","url":"https://api.github.com/users/astropy","html_url":"https://github.com/astropy","followers_url":"https://api.github.com/users/astropy/followers","following_url":"https://api.github.com/users/astropy/following{/other_user}","gists_url":"https://api.github.com/users/astropy/gists{/gist_id}","starred_url":"https://api.github.com/users/astropy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astropy/subscriptions","organizations_url":"https://api.github.com/users/astropy/orgs","repos_url":"https://api.github.com/users/astropy/repos","events_url":"https://api.github.com/users/astropy/events{/privacy}","received_events_url":"https://api.github.com/users/astropy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/astropy/astropy","description":"Repository for the Astropy core package","fork":false,"url":"https://api.github.com/repos/astropy/astropy","forks_url":"https://api.github.com/repos/astropy/astropy/forks","keys_url":"https://api.github.com/repos/astropy/astropy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/astropy/astropy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/astropy/astropy/teams","hooks_url":"https://api.github.com/repos/astropy/astropy/hooks","issue_events_url":"https://api.github.com/repos/astropy/astropy/issues/events{/number}","events_url":"https://api.github.com/repos/astropy/astropy/events","assignees_url":"https://api.github.com/repos/astropy/astropy/assignees{/user}","branches_url":"https://api.github.com/repos/astropy/astropy/branches{/branch}","tags_url":"https://api.github.com/repos/astropy/astropy/tags","blobs_url":"https://api.github.com/repos/astropy/astropy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/astropy/astropy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/astropy/astropy/git/refs{/sha}","trees_url":"https://api.github.com/repos/astropy/astropy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/astropy/astropy/statuses/{sha}","languages_url":"https://api.github.com/repos/astropy/astropy/languages","stargazers_url":"https://api.github.com/repos/astropy/astropy/stargazers","contributors_url":"https://api.github.com/repos/astropy/astropy/contributors","subscribers_url":"https://api.github.com/repos/astropy/astropy/subscribers","subscription_url":"https://api.github.com/repos/astropy/astropy/subscription","commits_url":"https://api.github.com/repos/astropy/astropy/commits{/sha}","git_commits_url":"https://api.github.com/repos/astropy/astropy/git/commits{/sha}","comments_url":"https://api.github.com/repos/astropy/astropy/comments{/number}","issue_comment_url":"https://api.github.com/repos/astropy/astropy/issues/comments/{number}","contents_url":"https://api.github.com/repos/astropy/astropy/contents/{+path}","compare_url":"https://api.github.com/repos/astropy/astropy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/astropy/astropy/merges","archive_url":"https://api.github.com/repos/astropy/astropy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/astropy/astropy/downloads","issues_url":"https://api.github.com/repos/astropy/astropy/issues{/number}","pulls_url":"https://api.github.com/repos/astropy/astropy/pulls{/number}","milestones_url":"https://api.github.com/repos/astropy/astropy/milestones{/number}","notifications_url":"https://api.github.com/repos/astropy/astropy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/astropy/astropy/labels{/name}","releases_url":"https://api.github.com/repos/astropy/astropy/releases{/id}","created_at":"2011-07-21T01:33:49Z","updated_at":"2015-01-15T17:25:51Z","pushed_at":"2015-01-15T15:24:35Z","git_url":"git://github.com/astropy/astropy.git","ssh_url":"git@github.com:astropy/astropy.git","clone_url":"https://github.com/astropy/astropy.git","svn_url":"https://github.com/astropy/astropy","homepage":"www.astropy.org","size":54160,"stargazers_count":488,"watchers_count":488,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":332,"mirror_url":null,"open_issues_count":407,"forks":332,"open_issues":407,"watchers":488,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3300"},"html":{"href":"https://github.com/astropy/astropy/pull/3300"},"issue":{"href":"https://api.github.com/repos/astropy/astropy/issues/3300"},"comments":{"href":"https://api.github.com/repos/astropy/astropy/issues/3300/comments"},"review_comments":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3300/comments"},"review_comment":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/astropy/astropy/pulls/3300/commits"},"statuses":{"href":"https://api.github.com/repos/astropy/astropy/statuses/ab8e7a21b768c7b2551f482c6ae6386beba30888"}}}}