{"action":"created","comment":{"url":"https://api.github.com/repos/XLSForm/pyxform/pulls/comments/48403633","id":48403633,"diff_hunk":"@@ -0,0 +1,134 @@\n+from pyxform_test_case import PyxformTestCase\n+\n+\n+class InvalidSurveyColumnsTests(PyxformTestCase):\n+    def test_missing_name(self):\n+        '''\n+        every question needs a name (or alias of name)\n+        '''\n+        self.assertPyxformXform(\n+            name='invalidcols',\n+            ss_structure={'survey': [{'type': 'text',\n+                                      'label': 'label'}]},\n+            errored=True,\n+            error__contains=['no name'],\n+        )\n+\n+    def test_missing_name_but_has_alias_of_name(self):\n+        self.assertPyxformXform(\n+            name='invalidcols',\n+            ss_structure={'survey': [{'value': 'q1',\n+                                      'type': 'text',\n+                                      'label': 'label'}]},\n+            errored=False,\n+        )\n+\n+    def test_missing_label(self):\n+        self.assertPyxformXform(\n+            name=\"invalidcols\",\n+            ss_structure={'survey': [{'type': 'text',\n+                                      'name': 'q1'}]},\n+            errored=True,\n+            error__contains=['no label or hint'],\n+        )\n+\n+\n+class InvalidChoiceSheetColumnsTests(PyxformTestCase):\n+    def _simple_choice_ss(self, choice_sheet=[]):\n+        return {'survey': [{'type': 'select_one l1',\n+                            'name': 'l1choice',\n+                            'label': 'select one from list l1'}],\n+                'choices': choice_sheet}\n+\n+    def test_valid_choices_sheet_passes(self):\n+        self.assertPyxformXform(\n+            name='valid_choices',\n+            ss_structure=self._simple_choice_ss([\n+                {'list_name': 'l1',\n+                    'name': 'c1',\n+                    'label': 'choice 1'},\n+                {'list_name': 'l1',\n+                    'name': 'c2',\n+                    'label': 'choice 2'}]),\n+            errored=False,\n+            )\n+\n+    def test_invalid_choices_sheet_fails(self):\n+        self.assertPyxformXform(\n+            name='missing_name',\n+            ss_structure=self._simple_choice_ss([\n+                {'list_name': 'l1',\n+                    'label': 'choice 1'},\n+                {'list_name': 'l1',\n+                    'label': 'choice 2'},\n+                ]),\n+            errored=True,\n+            error__contains=['option with no name'],\n+            )\n+\n+    def test_missing_list_name(self):\n+        self.assertPyxformXform(\n+            name='missing_list_name',\n+            ss_structure=self._simple_choice_ss([\n+                {'bad_column': 'l1',\n+                    'name': 'l1c1',\n+                    'label': 'choice 1'},\n+                {'bad_column': 'l1',\n+                    'name': 'l1c1',\n+                    'label': 'choice 2'},\n+                ]),\n+            debug=True,\n+            errored=True,\n+            # some basic keywords that should be in the error:\n+            error__contains=[\n+                'choices',\n+                'name',\n+                'list name',\n+            ])\n+\n+\n+class AliasesTests(PyxformTestCase):\n+    def test_value_and_name(self):\n+        '''\n+        confirm that both 'name' and 'value' both compile to xforms with the\n+        correct output.\n+        '''\n+        for name_alias in ['name', 'value']:\n+            self.assertPyxformXform(\n+                name=\"aliases\",\n+                md=\"\"\"\n+                | survey |      |                |            |\n+                |        | type | %(name_alias)s | label      |\n+                |        | text | q1             | Question 1 |\n+                \"\"\" % ({\n+                        u'name_alias': name_alias\n+                    }),\n+                instance__contains=[\n+                    '<q1/>',\n+                    ],\n+                model__contains=[\n+                    '<bind nodeset=\"/aliases/q1\" type=\"string\"/>',\n+                    ],\n+                xml__contains=[\n+                    '<input ref=\"/aliases/q1\">',\n+                    '<label>Question 1</label>',\n+                    '</input>',\n+                    ])\n+''' # uncomment when re-implemented","path":"pyxform/tests_v1/test_sheet_columns.py","position":117,"original_position":117,"commit_id":"896956b713cb282d0f4f3663846ec2dafb6bf28d","original_commit_id":"896956b713cb282d0f4f3663846ec2dafb6bf28d","user":{"login":"dorey","id":97589,"avatar_url":"https://avatars.githubusercontent.com/u/97589?v=3","gravatar_id":"","url":"https://api.github.com/users/dorey","html_url":"https://github.com/dorey","followers_url":"https://api.github.com/users/dorey/followers","following_url":"https://api.github.com/users/dorey/following{/other_user}","gists_url":"https://api.github.com/users/dorey/gists{/gist_id}","starred_url":"https://api.github.com/users/dorey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorey/subscriptions","organizations_url":"https://api.github.com/users/dorey/orgs","repos_url":"https://api.github.com/users/dorey/repos","events_url":"https://api.github.com/users/dorey/events{/privacy}","received_events_url":"https://api.github.com/users/dorey/received_events","type":"User","site_admin":false},"body":"I was thinking of fixing it in this PR but i didn't get to it. I kept it in as a note about some incomplete behavior associated with aliases. I could attach it to a new issue to fix when-time.","created_at":"2015-12-24T08:53:59Z","updated_at":"2015-12-24T08:53:59Z","html_url":"https://github.com/XLSForm/pyxform/pull/55#discussion_r48403633","pull_request_url":"https://api.github.com/repos/XLSForm/pyxform/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/comments/48403633"},"html":{"href":"https://github.com/XLSForm/pyxform/pull/55#discussion_r48403633"},"pull_request":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/XLSForm/pyxform/pulls/55","id":53901902,"html_url":"https://github.com/XLSForm/pyxform/pull/55","diff_url":"https://github.com/XLSForm/pyxform/pull/55.diff","patch_url":"https://github.com/XLSForm/pyxform/pull/55.patch","issue_url":"https://api.github.com/repos/XLSForm/pyxform/issues/55","number":55,"state":"open","locked":false,"title":"Allows \"value\" as an alias for \"name\"","user":{"login":"dorey","id":97589,"avatar_url":"https://avatars.githubusercontent.com/u/97589?v=3","gravatar_id":"","url":"https://api.github.com/users/dorey","html_url":"https://github.com/dorey","followers_url":"https://api.github.com/users/dorey/followers","following_url":"https://api.github.com/users/dorey/following{/other_user}","gists_url":"https://api.github.com/users/dorey/gists{/gist_id}","starred_url":"https://api.github.com/users/dorey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dorey/subscriptions","organizations_url":"https://api.github.com/users/dorey/orgs","repos_url":"https://api.github.com/users/dorey/repos","events_url":"https://api.github.com/users/dorey/events{/privacy}","received_events_url":"https://api.github.com/users/dorey/received_events","type":"User","site_admin":false},"body":"* allows \"value\" as an alias for \"name\" (as in old behavior)\r\n* moves existing tests away from xls fixtures\r\n","created_at":"2015-12-16T21:35:35Z","updated_at":"2015-12-24T08:53:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1c9b267cbc41d0e9e58e4b0bc4aec1e0da401998","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/XLSForm/pyxform/pulls/55/commits","review_comments_url":"https://api.github.com/repos/XLSForm/pyxform/pulls/55/comments","review_comment_url":"https://api.github.com/repos/XLSForm/pyxform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/XLSForm/pyxform/issues/55/comments","statuses_url":"https://api.github.com/repos/XLSForm/pyxform/statuses/896956b713cb282d0f4f3663846ec2dafb6bf28d","head":{"label":"XLSForm:issue-54","ref":"issue-54","sha":"896956b713cb282d0f4f3663846ec2dafb6bf28d","user":{"login":"XLSForm","id":4701113,"avatar_url":"https://avatars.githubusercontent.com/u/4701113?v=3","gravatar_id":"","url":"https://api.github.com/users/XLSForm","html_url":"https://github.com/XLSForm","followers_url":"https://api.github.com/users/XLSForm/followers","following_url":"https://api.github.com/users/XLSForm/following{/other_user}","gists_url":"https://api.github.com/users/XLSForm/gists{/gist_id}","starred_url":"https://api.github.com/users/XLSForm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XLSForm/subscriptions","organizations_url":"https://api.github.com/users/XLSForm/orgs","repos_url":"https://api.github.com/users/XLSForm/repos","events_url":"https://api.github.com/users/XLSForm/events{/privacy}","received_events_url":"https://api.github.com/users/XLSForm/received_events","type":"Organization","site_admin":false},"repo":{"id":23349633,"name":"pyxform","full_name":"XLSForm/pyxform","owner":{"login":"XLSForm","id":4701113,"avatar_url":"https://avatars.githubusercontent.com/u/4701113?v=3","gravatar_id":"","url":"https://api.github.com/users/XLSForm","html_url":"https://github.com/XLSForm","followers_url":"https://api.github.com/users/XLSForm/followers","following_url":"https://api.github.com/users/XLSForm/following{/other_user}","gists_url":"https://api.github.com/users/XLSForm/gists{/gist_id}","starred_url":"https://api.github.com/users/XLSForm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XLSForm/subscriptions","organizations_url":"https://api.github.com/users/XLSForm/orgs","repos_url":"https://api.github.com/users/XLSForm/repos","events_url":"https://api.github.com/users/XLSForm/events{/privacy}","received_events_url":"https://api.github.com/users/XLSForm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/XLSForm/pyxform","description":"A Python package to create XForms for ODK Collect.","fork":false,"url":"https://api.github.com/repos/XLSForm/pyxform","forks_url":"https://api.github.com/repos/XLSForm/pyxform/forks","keys_url":"https://api.github.com/repos/XLSForm/pyxform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/XLSForm/pyxform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/XLSForm/pyxform/teams","hooks_url":"https://api.github.com/repos/XLSForm/pyxform/hooks","issue_events_url":"https://api.github.com/repos/XLSForm/pyxform/issues/events{/number}","events_url":"https://api.github.com/repos/XLSForm/pyxform/events","assignees_url":"https://api.github.com/repos/XLSForm/pyxform/assignees{/user}","branches_url":"https://api.github.com/repos/XLSForm/pyxform/branches{/branch}","tags_url":"https://api.github.com/repos/XLSForm/pyxform/tags","blobs_url":"https://api.github.com/repos/XLSForm/pyxform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/XLSForm/pyxform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/XLSForm/pyxform/git/refs{/sha}","trees_url":"https://api.github.com/repos/XLSForm/pyxform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/XLSForm/pyxform/statuses/{sha}","languages_url":"https://api.github.com/repos/XLSForm/pyxform/languages","stargazers_url":"https://api.github.com/repos/XLSForm/pyxform/stargazers","contributors_url":"https://api.github.com/repos/XLSForm/pyxform/contributors","subscribers_url":"https://api.github.com/repos/XLSForm/pyxform/subscribers","subscription_url":"https://api.github.com/repos/XLSForm/pyxform/subscription","commits_url":"https://api.github.com/repos/XLSForm/pyxform/commits{/sha}","git_commits_url":"https://api.github.com/repos/XLSForm/pyxform/git/commits{/sha}","comments_url":"https://api.github.com/repos/XLSForm/pyxform/comments{/number}","issue_comment_url":"https://api.github.com/repos/XLSForm/pyxform/issues/comments{/number}","contents_url":"https://api.github.com/repos/XLSForm/pyxform/contents/{+path}","compare_url":"https://api.github.com/repos/XLSForm/pyxform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/XLSForm/pyxform/merges","archive_url":"https://api.github.com/repos/XLSForm/pyxform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/XLSForm/pyxform/downloads","issues_url":"https://api.github.com/repos/XLSForm/pyxform/issues{/number}","pulls_url":"https://api.github.com/repos/XLSForm/pyxform/pulls{/number}","milestones_url":"https://api.github.com/repos/XLSForm/pyxform/milestones{/number}","notifications_url":"https://api.github.com/repos/XLSForm/pyxform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/XLSForm/pyxform/labels{/name}","releases_url":"https://api.github.com/repos/XLSForm/pyxform/releases{/id}","created_at":"2014-08-26T11:45:05Z","updated_at":"2015-12-14T20:41:55Z","pushed_at":"2015-12-24T08:05:57Z","git_url":"git://github.com/XLSForm/pyxform.git","ssh_url":"git@github.com:XLSForm/pyxform.git","clone_url":"https://github.com/XLSForm/pyxform.git","svn_url":"https://github.com/XLSForm/pyxform","homepage":"","size":6015,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":29,"forks":48,"open_issues":29,"watchers":10,"default_branch":"master"}},"base":{"label":"XLSForm:master","ref":"master","sha":"01af7fd899c4d6be62abe52c5ea2262aedb6ee2b","user":{"login":"XLSForm","id":4701113,"avatar_url":"https://avatars.githubusercontent.com/u/4701113?v=3","gravatar_id":"","url":"https://api.github.com/users/XLSForm","html_url":"https://github.com/XLSForm","followers_url":"https://api.github.com/users/XLSForm/followers","following_url":"https://api.github.com/users/XLSForm/following{/other_user}","gists_url":"https://api.github.com/users/XLSForm/gists{/gist_id}","starred_url":"https://api.github.com/users/XLSForm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XLSForm/subscriptions","organizations_url":"https://api.github.com/users/XLSForm/orgs","repos_url":"https://api.github.com/users/XLSForm/repos","events_url":"https://api.github.com/users/XLSForm/events{/privacy}","received_events_url":"https://api.github.com/users/XLSForm/received_events","type":"Organization","site_admin":false},"repo":{"id":23349633,"name":"pyxform","full_name":"XLSForm/pyxform","owner":{"login":"XLSForm","id":4701113,"avatar_url":"https://avatars.githubusercontent.com/u/4701113?v=3","gravatar_id":"","url":"https://api.github.com/users/XLSForm","html_url":"https://github.com/XLSForm","followers_url":"https://api.github.com/users/XLSForm/followers","following_url":"https://api.github.com/users/XLSForm/following{/other_user}","gists_url":"https://api.github.com/users/XLSForm/gists{/gist_id}","starred_url":"https://api.github.com/users/XLSForm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XLSForm/subscriptions","organizations_url":"https://api.github.com/users/XLSForm/orgs","repos_url":"https://api.github.com/users/XLSForm/repos","events_url":"https://api.github.com/users/XLSForm/events{/privacy}","received_events_url":"https://api.github.com/users/XLSForm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/XLSForm/pyxform","description":"A Python package to create XForms for ODK Collect.","fork":false,"url":"https://api.github.com/repos/XLSForm/pyxform","forks_url":"https://api.github.com/repos/XLSForm/pyxform/forks","keys_url":"https://api.github.com/repos/XLSForm/pyxform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/XLSForm/pyxform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/XLSForm/pyxform/teams","hooks_url":"https://api.github.com/repos/XLSForm/pyxform/hooks","issue_events_url":"https://api.github.com/repos/XLSForm/pyxform/issues/events{/number}","events_url":"https://api.github.com/repos/XLSForm/pyxform/events","assignees_url":"https://api.github.com/repos/XLSForm/pyxform/assignees{/user}","branches_url":"https://api.github.com/repos/XLSForm/pyxform/branches{/branch}","tags_url":"https://api.github.com/repos/XLSForm/pyxform/tags","blobs_url":"https://api.github.com/repos/XLSForm/pyxform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/XLSForm/pyxform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/XLSForm/pyxform/git/refs{/sha}","trees_url":"https://api.github.com/repos/XLSForm/pyxform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/XLSForm/pyxform/statuses/{sha}","languages_url":"https://api.github.com/repos/XLSForm/pyxform/languages","stargazers_url":"https://api.github.com/repos/XLSForm/pyxform/stargazers","contributors_url":"https://api.github.com/repos/XLSForm/pyxform/contributors","subscribers_url":"https://api.github.com/repos/XLSForm/pyxform/subscribers","subscription_url":"https://api.github.com/repos/XLSForm/pyxform/subscription","commits_url":"https://api.github.com/repos/XLSForm/pyxform/commits{/sha}","git_commits_url":"https://api.github.com/repos/XLSForm/pyxform/git/commits{/sha}","comments_url":"https://api.github.com/repos/XLSForm/pyxform/comments{/number}","issue_comment_url":"https://api.github.com/repos/XLSForm/pyxform/issues/comments{/number}","contents_url":"https://api.github.com/repos/XLSForm/pyxform/contents/{+path}","compare_url":"https://api.github.com/repos/XLSForm/pyxform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/XLSForm/pyxform/merges","archive_url":"https://api.github.com/repos/XLSForm/pyxform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/XLSForm/pyxform/downloads","issues_url":"https://api.github.com/repos/XLSForm/pyxform/issues{/number}","pulls_url":"https://api.github.com/repos/XLSForm/pyxform/pulls{/number}","milestones_url":"https://api.github.com/repos/XLSForm/pyxform/milestones{/number}","notifications_url":"https://api.github.com/repos/XLSForm/pyxform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/XLSForm/pyxform/labels{/name}","releases_url":"https://api.github.com/repos/XLSForm/pyxform/releases{/id}","created_at":"2014-08-26T11:45:05Z","updated_at":"2015-12-14T20:41:55Z","pushed_at":"2015-12-24T08:05:57Z","git_url":"git://github.com/XLSForm/pyxform.git","ssh_url":"git@github.com:XLSForm/pyxform.git","clone_url":"https://github.com/XLSForm/pyxform.git","svn_url":"https://github.com/XLSForm/pyxform","homepage":"","size":6015,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":29,"forks":48,"open_issues":29,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/55"},"html":{"href":"https://github.com/XLSForm/pyxform/pull/55"},"issue":{"href":"https://api.github.com/repos/XLSForm/pyxform/issues/55"},"comments":{"href":"https://api.github.com/repos/XLSForm/pyxform/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/XLSForm/pyxform/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/XLSForm/pyxform/statuses/896956b713cb282d0f4f3663846ec2dafb6bf28d"}}}}