{"action":"created","comment":{"url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/comments/83678896","pull_request_review_id":4498443,"id":83678896,"diff_hunk":"@@ -0,0 +1,207 @@\n+from __future__ import absolute_import, division, print_function\n+from future.utils import with_metaclass\n+#\n+# LSST Data Management System\n+# Copyright 2016 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 abc\n+import os\n+\n+import lsst.afw.geom\n+import lsst.utils.tests\n+import lsst.daf.persistence\n+import lsst.afw.image\n+import collections\n+\n+\n+class MapperTests(with_metaclass(abc.ABCMeta)):\n+    \"\"\"\n+    Generic tests of obs_* package mapper functionality.\n+\n+    In the subclasses's setUp():\n+        * Instantiate a Mapper on the testdata repository as self.mapper.\n+        * Set self.dataIds to a dictionary of exposure names:dataId of that\n+          exposure in the testdata repository, with unittest.SkipTest as the\n+          value for any exposures you do not have/do not want to test. It must\n+          contain a valid 'raw' dataId, in addition to 'bias','flat','dark',\n+          which may be set to SkipTest. For example::\n+              self.dataIds = {'raw': {'visit': 1, 'filter': 'g'},\n+                              'bias': {'visit': 1},\n+                              'flat': {'visit': 1},\n+                              'dark': unittest.SkipTest\n+        * Call setUp_mapper() to fill in required parameters.\n+    \"\"\"\n+\n+    def setUp_mapper(self,\n+                     output=None,\n+                     path_to_raw=None,\n+                     keys=None,\n+                     query_format=None,\n+                     queryMetadata=None,\n+                     metadata_output_path=None,\n+                     map_python_type=None,\n+                     map_cpp_type=None,\n+                     map_storage_name=None,\n+                     raw_filename=None,\n+                     default_level=None,\n+                     raw_levels=None,\n+                     ):\n+        \"\"\"\n+        Set up the necessary variables for mapper tests.\n+\n+        output: str\n+            full path to output repository (can be the same as data_dir input repository)\n+        path_to_raw: str\n+            full path to the raw file referenced by dataIds['raw']\n+        keys: set\n+            dictionary keys that this mapper should contain\n+        query_format: list\n+            format list for the results portion of queryMetadata\n+        queryMetadata: tuple of (dict, tuple)\n+            dataIds and the results of calling them in queryMetadata\n+        metadata_output_path: str\n+            path to metadata output associated with dataIds['raw']\n+        map_python_type: str\n+            full python type specification returned by the mapper for dataIds['raw']\n+        map_cpp_type: str\n+            C++ type specification returned by the mapper for dataIds['raw']\n+        map_storage_name: str\n+            butler name for the storage type dataIds['raw']\n+        raw_filename: str\n+            Name of the raw files returned by the mapper for dataIds['raw']\n+        default_level: str\n+            value returned from mapper.getDefaultLevel\n+        raw_levels: tuple of (str, set of str)\n+            (level, expect) level and expected mapper return for mapper.getKeys('raw', level)\n+        \"\"\"\n+        fields = ['output',\n+                  'path_to_raw',\n+                  'keys',\n+                  'query_format',\n+                  'queryMetadata',\n+                  'metadata_output_path',\n+                  'map_python_type',\n+                  'map_cpp_type',\n+                  'map_storage_name',\n+                  'raw_filename',\n+                  'default_level',\n+                  'raw_levels',\n+                  ]\n+        MapperData = collections.namedtuple(\"MapperData\", fields)\n+        self.mapperData = MapperData(output=output,\n+                                     path_to_raw=path_to_raw,\n+                                     keys=keys,\n+                                     query_format=query_format,\n+                                     queryMetadata=queryMetadata,\n+                                     metadata_output_path=metadata_output_path,\n+                                     map_python_type=map_python_type,\n+                                     map_cpp_type=map_cpp_type,\n+                                     map_storage_name=map_storage_name,\n+                                     raw_filename=raw_filename,\n+                                     default_level=default_level,\n+                                     raw_levels=raw_levels,\n+                                     )\n+\n+    def tearDown(self):\n+        del self.mapper\n+        super(MapperTests, self).tearDown()\n+\n+    def test_map_config_data(self):\n+        dataId = self.dataIds['raw']\n+        butlerLocation = self.mapper.map_processCcd_config(dataId)\n+        self.assertEqual(butlerLocation.getPythonType(), \"lsst.pipe.tasks.processCcd.ProcessCcdConfig\")\n+        self.assertEqual(butlerLocation.getCppType(), \"Config\")\n+        self.assertEqual(butlerLocation.getStorageName(), \"ConfigStorage\")\n+        processCcd_path = os.path.join(self.mapperData.output, \"config\", \"processCcd.py\")\n+        self.assertEqual(butlerLocation.getLocations(), [processCcd_path])\n+        for k, v in dataId.items():\n+            self.assertEqual(butlerLocation.getAdditionalData().get(k), v, msg=\"Failed for key={}\".format(k))\n+\n+    def test_map_metadata_data(self):\n+        dataId = self.dataIds['raw']\n+        butlerLocation = self.mapper.map_processCcd_metadata(dataId)\n+        self.assertEqual(butlerLocation.getPythonType(), \"lsst.daf.base.PropertySet\")\n+        self.assertEqual(butlerLocation.getCppType(), \"PropertySet\")\n+        self.assertEqual(butlerLocation.getStorageName(), \"BoostStorage\")\n+        self.assertEqual(butlerLocation.getLocations(), [self.mapperData.metadata_output_path])","path":"python/lsst/obs/base/mapper_tests.py","position":143,"original_position":143,"commit_id":"ae1466aa265032015dec3b6a98eb735533c4ed9c","original_commit_id":"ae1466aa265032015dec3b6a98eb735533c4ed9c","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":"`assertListEqual`?","created_at":"2016-10-17T16:14:28Z","updated_at":"2016-10-17T16:14:28Z","html_url":"https://github.com/lsst-dm/obs_base/pull/2#discussion_r83678896","pull_request_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/comments/83678896"},"html":{"href":"https://github.com/lsst-dm/obs_base/pull/2#discussion_r83678896"},"pull_request":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2","id":89107157,"html_url":"https://github.com/lsst-dm/obs_base/pull/2","diff_url":"https://github.com/lsst-dm/obs_base/pull/2.diff","patch_url":"https://github.com/lsst-dm/obs_base/pull/2.patch","issue_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/2","number":2,"state":"open","locked":false,"title":"Added testing files for building obs_* package tests tickets/dm 7578","user":{"login":"parejkoj","id":1606089,"avatar_url":"https://avatars.githubusercontent.com/u/1606089?v=3","gravatar_id":"","url":"https://api.github.com/users/parejkoj","html_url":"https://github.com/parejkoj","followers_url":"https://api.github.com/users/parejkoj/followers","following_url":"https://api.github.com/users/parejkoj/following{/other_user}","gists_url":"https://api.github.com/users/parejkoj/gists{/gist_id}","starred_url":"https://api.github.com/users/parejkoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parejkoj/subscriptions","organizations_url":"https://api.github.com/users/parejkoj/orgs","repos_url":"https://api.github.com/users/parejkoj/repos","events_url":"https://api.github.com/users/parejkoj/events{/privacy}","received_events_url":"https://api.github.com/users/parejkoj/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-12T22:39:37Z","updated_at":"2016-10-17T16:24:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b4741249f0bbe840345575d0795610c6dee96d48","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2/commits","review_comments_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2/comments","review_comment_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/2/comments","statuses_url":"https://api.github.com/repos/lsst-dm/obs_base/statuses/ae1466aa265032015dec3b6a98eb735533c4ed9c","head":{"label":"lsst-dm:tickets/DM-7578","ref":"tickets/DM-7578","sha":"ae1466aa265032015dec3b6a98eb735533c4ed9c","user":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"repo":{"id":70282456,"name":"obs_base","full_name":"lsst-dm/obs_base","owner":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst-dm/obs_base","description":"Data access utilities and camera-specialization interfaces for LSST Data Management.","fork":true,"url":"https://api.github.com/repos/lsst-dm/obs_base","forks_url":"https://api.github.com/repos/lsst-dm/obs_base/forks","keys_url":"https://api.github.com/repos/lsst-dm/obs_base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst-dm/obs_base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst-dm/obs_base/teams","hooks_url":"https://api.github.com/repos/lsst-dm/obs_base/hooks","issue_events_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/events{/number}","events_url":"https://api.github.com/repos/lsst-dm/obs_base/events","assignees_url":"https://api.github.com/repos/lsst-dm/obs_base/assignees{/user}","branches_url":"https://api.github.com/repos/lsst-dm/obs_base/branches{/branch}","tags_url":"https://api.github.com/repos/lsst-dm/obs_base/tags","blobs_url":"https://api.github.com/repos/lsst-dm/obs_base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst-dm/obs_base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst-dm/obs_base/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst-dm/obs_base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst-dm/obs_base/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst-dm/obs_base/languages","stargazers_url":"https://api.github.com/repos/lsst-dm/obs_base/stargazers","contributors_url":"https://api.github.com/repos/lsst-dm/obs_base/contributors","subscribers_url":"https://api.github.com/repos/lsst-dm/obs_base/subscribers","subscription_url":"https://api.github.com/repos/lsst-dm/obs_base/subscription","commits_url":"https://api.github.com/repos/lsst-dm/obs_base/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst-dm/obs_base/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst-dm/obs_base/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst-dm/obs_base/contents/{+path}","compare_url":"https://api.github.com/repos/lsst-dm/obs_base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst-dm/obs_base/merges","archive_url":"https://api.github.com/repos/lsst-dm/obs_base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst-dm/obs_base/downloads","issues_url":"https://api.github.com/repos/lsst-dm/obs_base/issues{/number}","pulls_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst-dm/obs_base/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst-dm/obs_base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst-dm/obs_base/labels{/name}","releases_url":"https://api.github.com/repos/lsst-dm/obs_base/releases{/id}","deployments_url":"https://api.github.com/repos/lsst-dm/obs_base/deployments","created_at":"2016-10-07T20:59:17Z","updated_at":"2016-10-07T21:02:33Z","pushed_at":"2016-10-15T02:26:42Z","git_url":"git://github.com/lsst-dm/obs_base.git","ssh_url":"git@github.com:lsst-dm/obs_base.git","clone_url":"https://github.com/lsst-dm/obs_base.git","svn_url":"https://github.com/lsst-dm/obs_base","homepage":"http://dm.lsst.org","size":37023,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lsst-dm:master","ref":"master","sha":"024bdff2bc55f5d726ff85d807592377701bb01a","user":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"repo":{"id":70282456,"name":"obs_base","full_name":"lsst-dm/obs_base","owner":{"login":"lsst-dm","id":10968870,"avatar_url":"https://avatars.githubusercontent.com/u/10968870?v=3","gravatar_id":"","url":"https://api.github.com/users/lsst-dm","html_url":"https://github.com/lsst-dm","followers_url":"https://api.github.com/users/lsst-dm/followers","following_url":"https://api.github.com/users/lsst-dm/following{/other_user}","gists_url":"https://api.github.com/users/lsst-dm/gists{/gist_id}","starred_url":"https://api.github.com/users/lsst-dm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lsst-dm/subscriptions","organizations_url":"https://api.github.com/users/lsst-dm/orgs","repos_url":"https://api.github.com/users/lsst-dm/repos","events_url":"https://api.github.com/users/lsst-dm/events{/privacy}","received_events_url":"https://api.github.com/users/lsst-dm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lsst-dm/obs_base","description":"Data access utilities and camera-specialization interfaces for LSST Data Management.","fork":true,"url":"https://api.github.com/repos/lsst-dm/obs_base","forks_url":"https://api.github.com/repos/lsst-dm/obs_base/forks","keys_url":"https://api.github.com/repos/lsst-dm/obs_base/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lsst-dm/obs_base/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lsst-dm/obs_base/teams","hooks_url":"https://api.github.com/repos/lsst-dm/obs_base/hooks","issue_events_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/events{/number}","events_url":"https://api.github.com/repos/lsst-dm/obs_base/events","assignees_url":"https://api.github.com/repos/lsst-dm/obs_base/assignees{/user}","branches_url":"https://api.github.com/repos/lsst-dm/obs_base/branches{/branch}","tags_url":"https://api.github.com/repos/lsst-dm/obs_base/tags","blobs_url":"https://api.github.com/repos/lsst-dm/obs_base/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lsst-dm/obs_base/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lsst-dm/obs_base/git/refs{/sha}","trees_url":"https://api.github.com/repos/lsst-dm/obs_base/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lsst-dm/obs_base/statuses/{sha}","languages_url":"https://api.github.com/repos/lsst-dm/obs_base/languages","stargazers_url":"https://api.github.com/repos/lsst-dm/obs_base/stargazers","contributors_url":"https://api.github.com/repos/lsst-dm/obs_base/contributors","subscribers_url":"https://api.github.com/repos/lsst-dm/obs_base/subscribers","subscription_url":"https://api.github.com/repos/lsst-dm/obs_base/subscription","commits_url":"https://api.github.com/repos/lsst-dm/obs_base/commits{/sha}","git_commits_url":"https://api.github.com/repos/lsst-dm/obs_base/git/commits{/sha}","comments_url":"https://api.github.com/repos/lsst-dm/obs_base/comments{/number}","issue_comment_url":"https://api.github.com/repos/lsst-dm/obs_base/issues/comments{/number}","contents_url":"https://api.github.com/repos/lsst-dm/obs_base/contents/{+path}","compare_url":"https://api.github.com/repos/lsst-dm/obs_base/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lsst-dm/obs_base/merges","archive_url":"https://api.github.com/repos/lsst-dm/obs_base/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lsst-dm/obs_base/downloads","issues_url":"https://api.github.com/repos/lsst-dm/obs_base/issues{/number}","pulls_url":"https://api.github.com/repos/lsst-dm/obs_base/pulls{/number}","milestones_url":"https://api.github.com/repos/lsst-dm/obs_base/milestones{/number}","notifications_url":"https://api.github.com/repos/lsst-dm/obs_base/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lsst-dm/obs_base/labels{/name}","releases_url":"https://api.github.com/repos/lsst-dm/obs_base/releases{/id}","deployments_url":"https://api.github.com/repos/lsst-dm/obs_base/deployments","created_at":"2016-10-07T20:59:17Z","updated_at":"2016-10-07T21:02:33Z","pushed_at":"2016-10-15T02:26:42Z","git_url":"git://github.com/lsst-dm/obs_base.git","ssh_url":"git@github.com:lsst-dm/obs_base.git","clone_url":"https://github.com/lsst-dm/obs_base.git","svn_url":"https://github.com/lsst-dm/obs_base","homepage":"http://dm.lsst.org","size":37023,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2"},"html":{"href":"https://github.com/lsst-dm/obs_base/pull/2"},"issue":{"href":"https://api.github.com/repos/lsst-dm/obs_base/issues/2"},"comments":{"href":"https://api.github.com/repos/lsst-dm/obs_base/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lsst-dm/obs_base/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/lsst-dm/obs_base/statuses/ae1466aa265032015dec3b6a98eb735533c4ed9c"}}}}
{"actor":{"display_login":"PaulPrice"}}