{"action":"created","comment":{"url":"https://api.github.com/repos/lsst/afw/pulls/comments/32290364","id":32290364,"diff_hunk":"@@ -0,0 +1,176 @@\n+#!/usr/bin/env python\n+from __future__ import absolute_import, division, print_function\n+\n+# \n+# LSST Data Management System\n+# Copyright 2008, 2009, 2010 LSST Corporation.\n+# \n+# This product includes software developed by the\n+# LSST Project (http://www.lsst.org/).\n+#\n+# This program is free software: you can redistribute it and/or modify\n+# it under the terms of the GNU General Public License as published by\n+# the Free Software Foundation, either version 3 of the License, or\n+# (at your option) any later version.\n+# \n+# This program is distributed in the hope that it will be useful,\n+# but WITHOUT ANY WARRANTY; without even the implied warranty of\n+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+# GNU General Public License for more details.\n+# \n+# You should have received a copy of the LSST License Statement and \n+# the GNU General Public License along with this program.  If not, \n+# see <http://www.lsstcorp.org/LegalNotices/>.\n+#\n+import math\n+import unittest\n+\n+import lsst.utils.tests as utilsTests\n+import lsst.daf.base as dafBase\n+import lsst.afw.coord as afwCoord\n+import lsst.afw.geom as afwGeom\n+import lsst.afw.image as afwImage\n+\n+class TestTestUtils(utilsTests.TestCase):\n+    \"\"\"Test test methods added to lsst.utils.tests.TestCase\n+    \"\"\"\n+    def testAssertAnglesNearlyEqual(self):\n+        \"\"\"Test assertAnglesNearlyEqual\"\"\"\n+        for angDeg in (0, 45, -75):\n+            ang0 = angDeg*afwGeom.degrees\n+            self.assertAnglesNearlyEqual(\n+                ang0,\n+                ang0 + 0.01*afwGeom.arcseconds,\n+                maxDiff=0.010001*afwGeom.arcseconds,\n+            )\n+            self.assertAnglesNearlyEqual(\n+                ang0,\n+                ang0 - 0.01*afwGeom.arcseconds,\n+                maxDiff=0.010001*afwGeom.arcseconds,\n+            )\n+            self.assertAnglesNearlyEqual(\n+                ang0 - 720*afwGeom.degrees,\n+                ang0 + 0.01*afwGeom.arcseconds,\n+                maxDiff=0.010001*afwGeom.arcseconds,\n+            )\n+            self.assertAnglesNearlyEqual(\n+                ang0,\n+                ang0 + 360*afwGeom.degrees + 0.01*afwGeom.arcseconds,\n+                maxDiff=0.010001*afwGeom.arcseconds,\n+            )\n+            self.assertRaises(AssertionError,\n+                self.assertAnglesNearlyEqual,\n+                    ang0,\n+                    ang0 + 360*afwGeom.degrees + 0.010001*afwGeom.arcseconds,\n+                    maxDiff=0.01*afwGeom.arcseconds,\n+            )\n+\n+    def testAssertBoxesNearlyEqual(self):\n+        \"\"\"Test assertBoxesNearlyEqual\"\"\"\n+        for min0 in ((0, 0), (-1000.5, 5000.1)):\n+            min0 = afwGeom.Point2D(*min0)\n+            for extent0 in ((2.01, 3.01), (5432, 2342)):\n+                extent0 = afwGeom.Extent2D(*extent0)\n+                box0 = afwGeom.Box2D(min0, extent0)\n+                self.assertBoxesNearlyEqual(box0, box0, maxDiff=1e-7)\n+                for deltaExtent in ((0.001, -0.001), (2, -3)):\n+                    deltaExtent = afwGeom.Extent2D(*deltaExtent)\n+                    box1 = afwGeom.Box2D(box0.getMin() + deltaExtent, box0.getMax())\n+                    radDiff = math.hypot(*deltaExtent)\n+                    self.assertBoxesNearlyEqual(box0, box1, maxDiff=radDiff*1.00001)\n+                    self.assertRaises(AssertionError, self.assertBoxesNearlyEqual,\n+                        box0, box1, maxDiff=radDiff*0.99999)\n+\n+                    box2 = afwGeom.Box2D(box0.getMin() - deltaExtent, box0.getMax())\n+                    self.assertBoxesNearlyEqual(box0, box2, maxDiff=radDiff*1.00001)\n+                    self.assertRaises(AssertionError, self.assertBoxesNearlyEqual,\n+                        box0, box2, maxDiff=radDiff*0.999999)\n+\n+                    box3 = afwGeom.Box2D(box0.getMin(), box0.getMax() + deltaExtent)\n+                    self.assertBoxesNearlyEqual(box0, box3, maxDiff=radDiff*1.00001)\n+                    self.assertRaises(AssertionError, self.assertBoxesNearlyEqual,\n+                        box0, box3, maxDiff=radDiff*0.999999)\n+\n+    def testAssertCoordsNearlyEqual(self):\n+        \"\"\"Test assertCoordsNearlyEqual\"\"\"\n+        for raDecDeg in ((45, 45), (-70, 89), (130, -89.5)):","path":"tests/testTestMethods.py","position":96,"original_position":96,"commit_id":"bffa00e75960dba1aa8baa6da5e48ddc861d161d","original_commit_id":"bffa00e75960dba1aa8baa6da5e48ddc861d161d","user":{"login":"timj","id":60622,"avatar_url":"https://avatars.githubusercontent.com/u/60622?v=3","gravatar_id":"","url":"https://api.github.com/users/timj","html_url":"https://github.com/timj","followers_url":"https://api.github.com/users/timj/followers","following_url":"https://api.github.com/users/timj/following{/other_user}","gists_url":"https://api.github.com/users/timj/gists{/gist_id}","starred_url":"https://api.github.com/users/timj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timj/subscriptions","organizations_url":"https://api.github.com/users/timj/orgs","repos_url":"https://api.github.com/users/timj/repos","events_url":"https://api.github.com/users/timj/events{/privacy}","received_events_url":"https://api.github.com/users/timj/received_events","type":"User","site_admin":false},"body":"Yes. That's a very common mistake.","created_at":"2015-06-12T04:57:25Z","updated_at":"2015-06-12T04:57:25Z","html_url":"https://github.com/lsst/afw/pull/12#discussion_r32290364","pull_request_url":"https://api.github.com/repos/lsst/afw/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/lsst/afw/pulls/comments/32290364"},"html":{"href":"https://github.com/lsst/afw/pull/12#discussion_r32290364"},"pull_request":{"href":"https://api.github.com/repos/lsst/afw/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/lsst/afw/pulls/12","id":30303066,"html_url":"https://github.com/lsst/afw/pull/12","diff_url":"https://github.com/lsst/afw/pull/12.diff","patch_url":"https://github.com/lsst/afw/pull/12.patch","issue_url":"https://api.github.com/repos/lsst/afw/issues/12","number":12,"state":"open","locked":false,"title":"DM-2193: Add assertWcssAlmostEqual to testUtils","user":{"login":"PaulPrice","id":1334980,"avatar_url":"https://avatars.githubusercontent.com/u/1334980?v=3","gravatar_id":"","url":"https://api.github.com/users/PaulPrice","html_url":"https://github.com/PaulPrice","followers_url":"https://api.github.com/users/PaulPrice/followers","following_url":"https://api.github.com/users/PaulPrice/following{/other_user}","gists_url":"https://api.github.com/users/PaulPrice/gists{/gist_id}","starred_url":"https://api.github.com/users/PaulPrice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaulPrice/subscriptions","organizations_url":"https://api.github.com/users/PaulPrice/orgs","repos_url":"https://api.github.com/users/PaulPrice/repos","events_url":"https://api.github.com/users/PaulPrice/events{/privacy}","received_events_url":"https://api.github.com/users/PaulPrice/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-02T17:34:36Z","updated_at":"2015-06-12T04:57:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88e232d2359715d442fedb0bb1d3343c0d976a50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lsst/afw/pulls/12/commits","review_comments_url":"https://api.github.com/repos/lsst/afw/pulls/12/comments","review_comment_url":"https://api.github.com/repos/lsst/afw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lsst/afw/issues/12/comments","statuses_url":"https://api.github.com/repos/lsst/afw/statuses/bffa00e75960dba1aa8baa6da5e48ddc861d161d","head":{"label":"lsst:tickets/DM-2193","ref":"tickets/DM-2193","sha":"bffa00e75960dba1aa8baa6da5e48ddc861d161d","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013175,"name":"afw","full_name":"lsst/afw","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/afw","description":"LSST data management: astronomical framework, including images and tables","fork":false,"url":"https://api.github.com/repos/lsst/afw","forks_url":"https://api.github.com/repos/lsst/afw/forks","keys_url":"https://api.github.com/repos/lsst/afw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/afw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/afw/teams","hooks_url":"https://api.github.com/repos/lsst/afw/hooks","issue_events_url":"https://api.github.com/repos/lsst/afw/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/afw/events","assignees_url":"https://api.github.com/repos/lsst/afw/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/afw/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/afw/tags","blobs_url":"https://api.github.com/repos/lsst/afw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/afw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/afw/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/afw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/afw/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/afw/languages","stargazers_url":"https://api.github.com/repos/lsst/afw/stargazers","contributors_url":"https://api.github.com/repos/lsst/afw/contributors","subscribers_url":"https://api.github.com/repos/lsst/afw/subscribers","subscription_url":"https://api.github.com/repos/lsst/afw/subscription","commits_url":"https://api.github.com/repos/lsst/afw/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/afw/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/afw/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/afw/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/afw/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/afw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/afw/merges","archive_url":"https://api.github.com/repos/lsst/afw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/afw/downloads","issues_url":"https://api.github.com/repos/lsst/afw/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/afw/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/afw/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/afw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/afw/labels{/name}","releases_url":"https://api.github.com/repos/lsst/afw/releases{/id}","created_at":"2014-08-16T07:37:40Z","updated_at":"2015-05-06T04:04:00Z","pushed_at":"2015-06-12T00:44:19Z","git_url":"git://github.com/lsst/afw.git","ssh_url":"git@github.com:lsst/afw.git","clone_url":"https://github.com/lsst/afw.git","svn_url":"https://github.com/lsst/afw","homepage":"http://dm.lsst.org/","size":42082,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":6,"forks":3,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"lsst:master","ref":"master","sha":"52cfaab314ca5bd9097ff662680402f67ce74755","user":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"repo":{"id":23013175,"name":"afw","full_name":"lsst/afw","owner":{"login":"lsst","id":1134504,"avatar_url":"https://avatars.githubusercontent.com/u/1134504?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst","html_url":"https://github.com/lsst","followers_url":"https://api.github.com/users/lsst/followers","following_url":"https://api.github.com/users/lsst/following{/other_user}","gists_url":"https://api.github.com/users/lsst/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst/subscriptions","organizations_url":"https://api.github.com/users/lsst/orgs","repos_url":"https://api.github.com/users/lsst/repos","events_url":"https://api.github.com/users/lsst/events{/privacy}","received_events_url":"https://api.github.com/users/lsst/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst/afw","description":"LSST data management: astronomical framework, including images and tables","fork":false,"url":"https://api.github.com/repos/lsst/afw","forks_url":"https://api.github.com/repos/lsst/afw/forks","keys_url":"https://api.github.com/repos/lsst/afw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst/afw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst/afw/teams","hooks_url":"https://api.github.com/repos/lsst/afw/hooks","issue_events_url":"https://api.github.com/repos/lsst/afw/issues/events{/number}","events_url":"https://api.github.com/repos/lsst/afw/events","assignees_url":"https://api.github.com/repos/lsst/afw/assignees{/user}","branches_url":"https://api.github.com/repos/lsst/afw/branches{/branch}","tags_url":"https://api.github.com/repos/lsst/afw/tags","blobs_url":"https://api.github.com/repos/lsst/afw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst/afw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst/afw/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst/afw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst/afw/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst/afw/languages","stargazers_url":"https://api.github.com/repos/lsst/afw/stargazers","contributors_url":"https://api.github.com/repos/lsst/afw/contributors","subscribers_url":"https://api.github.com/repos/lsst/afw/subscribers","subscription_url":"https://api.github.com/repos/lsst/afw/subscription","commits_url":"https://api.github.com/repos/lsst/afw/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst/afw/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst/afw/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst/afw/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst/afw/contents/{+path}","compare_url":"https://api.github.com/repos/lsst/afw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst/afw/merges","archive_url":"https://api.github.com/repos/lsst/afw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst/afw/downloads","issues_url":"https://api.github.com/repos/lsst/afw/issues{/number}","pulls_url":"https://api.github.com/repos/lsst/afw/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst/afw/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst/afw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst/afw/labels{/name}","releases_url":"https://api.github.com/repos/lsst/afw/releases{/id}","created_at":"2014-08-16T07:37:40Z","updated_at":"2015-05-06T04:04:00Z","pushed_at":"2015-06-12T00:44:19Z","git_url":"git://github.com/lsst/afw.git","ssh_url":"git@github.com:lsst/afw.git","clone_url":"https://github.com/lsst/afw.git","svn_url":"https://github.com/lsst/afw","homepage":"http://dm.lsst.org/","size":42082,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":6,"forks":3,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst/afw/pulls/12"},"html":{"href":"https://github.com/lsst/afw/pull/12"},"issue":{"href":"https://api.github.com/repos/lsst/afw/issues/12"},"comments":{"href":"https://api.github.com/repos/lsst/afw/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst/afw/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst/afw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lsst/afw/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/lsst/afw/statuses/bffa00e75960dba1aa8baa6da5e48ddc861d161d"}}}}