{"action":"created","comment":{"url":"https://api.github.com/repos/apibyexample/abe-python/pulls/comments/45317076","id":45317076,"diff_hunk":"@@ -33,53 +33,71 @@ def get_sample_request(self, path, label):\n         sample_request = sample.examples[label].request\n         return sample_request.body\n \n-    def assert_data_equal(self, data1, data2):\n+    def assert_item_matches(self, real, sample):\n+        \"\"\"\n+        A primitive value matches the sample.\n+\n+        If the sample represents a parameter, then do simple pattern matching.\n+\n+        \"\"\"\n+        real = normalize(real)\n+        sample = normalize(sample)\n+        self.assertEqual(real, sample)\n+\n+    def assert_data_equal(self, real, sample, non_strict=None):\n         \"\"\"\n         Two elements are recursively equal\n+\n+        :param non_strict:\n+            Names of fields to match non-strictly. In current implementation,\n+            only check for field presence.\n         \"\"\"\n+        non_strict = non_strict or []\n         try:\n-            if isinstance(data1, list):\n-                self.assertIsInstance(data2, list)\n-                self.assert_data_list_equal(data1, data2)\n-            elif isinstance(data1, dict):\n-                self.assertIsInstance(data2, dict)\n-                self.assert_data_dict_equal(data1, data2)\n+            if isinstance(real, list):\n+                self.assertIsInstance(sample, list)","path":"abe/unittest.py","position":42,"original_position":42,"commit_id":"aac0c02d45d3115718231a57bed619df26d91476","original_commit_id":"ec6bc59f080bfc711922a9626a7b59305f46ea0e","user":{"login":"txels","id":874958,"avatar_url":"https://avatars.githubusercontent.com/u/874958?v=3","gravatar_id":"","url":"https://api.github.com/users/txels","html_url":"https://github.com/txels","followers_url":"https://api.github.com/users/txels/followers","following_url":"https://api.github.com/users/txels/following{/other_user}","gists_url":"https://api.github.com/users/txels/gists{/gist_id}","starred_url":"https://api.github.com/users/txels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/txels/subscriptions","organizations_url":"https://api.github.com/users/txels/orgs","repos_url":"https://api.github.com/users/txels/repos","events_url":"https://api.github.com/users/txels/events{/privacy}","received_events_url":"https://api.github.com/users/txels/received_events","type":"User","site_admin":false},"body":"Docstring to be precise...","created_at":"2015-11-19T09:23:36Z","updated_at":"2015-11-19T09:23:36Z","html_url":"https://github.com/apibyexample/abe-python/pull/14#discussion_r45317076","pull_request_url":"https://api.github.com/repos/apibyexample/abe-python/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/comments/45317076"},"html":{"href":"https://github.com/apibyexample/abe-python/pull/14#discussion_r45317076"},"pull_request":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/14"}}},"pull_request":{"url":"https://api.github.com/repos/apibyexample/abe-python/pulls/14","id":51143550,"html_url":"https://github.com/apibyexample/abe-python/pull/14","diff_url":"https://github.com/apibyexample/abe-python/pull/14.diff","patch_url":"https://github.com/apibyexample/abe-python/pull/14.patch","issue_url":"https://api.github.com/repos/apibyexample/abe-python/issues/14","number":14,"state":"open","locked":false,"title":"Support non-strict matching of samples","user":{"login":"txels","id":874958,"avatar_url":"https://avatars.githubusercontent.com/u/874958?v=3","gravatar_id":"","url":"https://api.github.com/users/txels","html_url":"https://github.com/txels","followers_url":"https://api.github.com/users/txels/followers","following_url":"https://api.github.com/users/txels/following{/other_user}","gists_url":"https://api.github.com/users/txels/gists{/gist_id}","starred_url":"https://api.github.com/users/txels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/txels/subscriptions","organizations_url":"https://api.github.com/users/txels/orgs","repos_url":"https://api.github.com/users/txels/repos","events_url":"https://api.github.com/users/txels/events{/privacy}","received_events_url":"https://api.github.com/users/txels/received_events","type":"User","site_admin":false},"body":"This provides an approach to *loose* matching that doesn't require changes in the spec.\r\n\r\n- `assert_matches_sample` includes an optional argument to skip matching certain response fields: it uses a hierarchical notation: e.g. `url`, `author.id`...\r\n- Added more test coverage in general\r\n\r\nSee tests for usage examples.\r\n","created_at":"2015-11-18T21:18:25Z","updated_at":"2015-11-19T09:23:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e19cb9b355eb34531b3715e14ece585a5a3114ff","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apibyexample/abe-python/pulls/14/commits","review_comments_url":"https://api.github.com/repos/apibyexample/abe-python/pulls/14/comments","review_comment_url":"https://api.github.com/repos/apibyexample/abe-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apibyexample/abe-python/issues/14/comments","statuses_url":"https://api.github.com/repos/apibyexample/abe-python/statuses/aac0c02d45d3115718231a57bed619df26d91476","head":{"label":"apibyexample:carles/non-strict-matching","ref":"carles/non-strict-matching","sha":"aac0c02d45d3115718231a57bed619df26d91476","user":{"login":"apibyexample","id":8582214,"avatar_url":"https://avatars.githubusercontent.com/u/8582214?v=3","gravatar_id":"","url":"https://api.github.com/users/apibyexample","html_url":"https://github.com/apibyexample","followers_url":"https://api.github.com/users/apibyexample/followers","following_url":"https://api.github.com/users/apibyexample/following{/other_user}","gists_url":"https://api.github.com/users/apibyexample/gists{/gist_id}","starred_url":"https://api.github.com/users/apibyexample/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apibyexample/subscriptions","organizations_url":"https://api.github.com/users/apibyexample/orgs","repos_url":"https://api.github.com/users/apibyexample/repos","events_url":"https://api.github.com/users/apibyexample/events{/privacy}","received_events_url":"https://api.github.com/users/apibyexample/received_events","type":"Organization","site_admin":false},"repo":{"id":23542529,"name":"abe-python","full_name":"apibyexample/abe-python","owner":{"login":"apibyexample","id":8582214,"avatar_url":"https://avatars.githubusercontent.com/u/8582214?v=3","gravatar_id":"","url":"https://api.github.com/users/apibyexample","html_url":"https://github.com/apibyexample","followers_url":"https://api.github.com/users/apibyexample/followers","following_url":"https://api.github.com/users/apibyexample/following{/other_user}","gists_url":"https://api.github.com/users/apibyexample/gists{/gist_id}","starred_url":"https://api.github.com/users/apibyexample/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apibyexample/subscriptions","organizations_url":"https://api.github.com/users/apibyexample/orgs","repos_url":"https://api.github.com/users/apibyexample/repos","events_url":"https://api.github.com/users/apibyexample/events{/privacy}","received_events_url":"https://api.github.com/users/apibyexample/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apibyexample/abe-python","description":"Python tooling around the ABE format","fork":false,"url":"https://api.github.com/repos/apibyexample/abe-python","forks_url":"https://api.github.com/repos/apibyexample/abe-python/forks","keys_url":"https://api.github.com/repos/apibyexample/abe-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apibyexample/abe-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apibyexample/abe-python/teams","hooks_url":"https://api.github.com/repos/apibyexample/abe-python/hooks","issue_events_url":"https://api.github.com/repos/apibyexample/abe-python/issues/events{/number}","events_url":"https://api.github.com/repos/apibyexample/abe-python/events","assignees_url":"https://api.github.com/repos/apibyexample/abe-python/assignees{/user}","branches_url":"https://api.github.com/repos/apibyexample/abe-python/branches{/branch}","tags_url":"https://api.github.com/repos/apibyexample/abe-python/tags","blobs_url":"https://api.github.com/repos/apibyexample/abe-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apibyexample/abe-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apibyexample/abe-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/apibyexample/abe-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apibyexample/abe-python/statuses/{sha}","languages_url":"https://api.github.com/repos/apibyexample/abe-python/languages","stargazers_url":"https://api.github.com/repos/apibyexample/abe-python/stargazers","contributors_url":"https://api.github.com/repos/apibyexample/abe-python/contributors","subscribers_url":"https://api.github.com/repos/apibyexample/abe-python/subscribers","subscription_url":"https://api.github.com/repos/apibyexample/abe-python/subscription","commits_url":"https://api.github.com/repos/apibyexample/abe-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/apibyexample/abe-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/apibyexample/abe-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/apibyexample/abe-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/apibyexample/abe-python/contents/{+path}","compare_url":"https://api.github.com/repos/apibyexample/abe-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apibyexample/abe-python/merges","archive_url":"https://api.github.com/repos/apibyexample/abe-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apibyexample/abe-python/downloads","issues_url":"https://api.github.com/repos/apibyexample/abe-python/issues{/number}","pulls_url":"https://api.github.com/repos/apibyexample/abe-python/pulls{/number}","milestones_url":"https://api.github.com/repos/apibyexample/abe-python/milestones{/number}","notifications_url":"https://api.github.com/repos/apibyexample/abe-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apibyexample/abe-python/labels{/name}","releases_url":"https://api.github.com/repos/apibyexample/abe-python/releases{/id}","created_at":"2014-09-01T12:57:23Z","updated_at":"2015-06-04T13:35:24Z","pushed_at":"2015-11-19T09:21:57Z","git_url":"git://github.com/apibyexample/abe-python.git","ssh_url":"git@github.com:apibyexample/abe-python.git","clone_url":"https://github.com/apibyexample/abe-python.git","svn_url":"https://github.com/apibyexample/abe-python","homepage":null,"size":31,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"apibyexample:master","ref":"master","sha":"4f3b980d92ead75238edd981cd8eb0235e255caf","user":{"login":"apibyexample","id":8582214,"avatar_url":"https://avatars.githubusercontent.com/u/8582214?v=3","gravatar_id":"","url":"https://api.github.com/users/apibyexample","html_url":"https://github.com/apibyexample","followers_url":"https://api.github.com/users/apibyexample/followers","following_url":"https://api.github.com/users/apibyexample/following{/other_user}","gists_url":"https://api.github.com/users/apibyexample/gists{/gist_id}","starred_url":"https://api.github.com/users/apibyexample/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apibyexample/subscriptions","organizations_url":"https://api.github.com/users/apibyexample/orgs","repos_url":"https://api.github.com/users/apibyexample/repos","events_url":"https://api.github.com/users/apibyexample/events{/privacy}","received_events_url":"https://api.github.com/users/apibyexample/received_events","type":"Organization","site_admin":false},"repo":{"id":23542529,"name":"abe-python","full_name":"apibyexample/abe-python","owner":{"login":"apibyexample","id":8582214,"avatar_url":"https://avatars.githubusercontent.com/u/8582214?v=3","gravatar_id":"","url":"https://api.github.com/users/apibyexample","html_url":"https://github.com/apibyexample","followers_url":"https://api.github.com/users/apibyexample/followers","following_url":"https://api.github.com/users/apibyexample/following{/other_user}","gists_url":"https://api.github.com/users/apibyexample/gists{/gist_id}","starred_url":"https://api.github.com/users/apibyexample/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apibyexample/subscriptions","organizations_url":"https://api.github.com/users/apibyexample/orgs","repos_url":"https://api.github.com/users/apibyexample/repos","events_url":"https://api.github.com/users/apibyexample/events{/privacy}","received_events_url":"https://api.github.com/users/apibyexample/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apibyexample/abe-python","description":"Python tooling around the ABE format","fork":false,"url":"https://api.github.com/repos/apibyexample/abe-python","forks_url":"https://api.github.com/repos/apibyexample/abe-python/forks","keys_url":"https://api.github.com/repos/apibyexample/abe-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apibyexample/abe-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apibyexample/abe-python/teams","hooks_url":"https://api.github.com/repos/apibyexample/abe-python/hooks","issue_events_url":"https://api.github.com/repos/apibyexample/abe-python/issues/events{/number}","events_url":"https://api.github.com/repos/apibyexample/abe-python/events","assignees_url":"https://api.github.com/repos/apibyexample/abe-python/assignees{/user}","branches_url":"https://api.github.com/repos/apibyexample/abe-python/branches{/branch}","tags_url":"https://api.github.com/repos/apibyexample/abe-python/tags","blobs_url":"https://api.github.com/repos/apibyexample/abe-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apibyexample/abe-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apibyexample/abe-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/apibyexample/abe-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apibyexample/abe-python/statuses/{sha}","languages_url":"https://api.github.com/repos/apibyexample/abe-python/languages","stargazers_url":"https://api.github.com/repos/apibyexample/abe-python/stargazers","contributors_url":"https://api.github.com/repos/apibyexample/abe-python/contributors","subscribers_url":"https://api.github.com/repos/apibyexample/abe-python/subscribers","subscription_url":"https://api.github.com/repos/apibyexample/abe-python/subscription","commits_url":"https://api.github.com/repos/apibyexample/abe-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/apibyexample/abe-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/apibyexample/abe-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/apibyexample/abe-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/apibyexample/abe-python/contents/{+path}","compare_url":"https://api.github.com/repos/apibyexample/abe-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apibyexample/abe-python/merges","archive_url":"https://api.github.com/repos/apibyexample/abe-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apibyexample/abe-python/downloads","issues_url":"https://api.github.com/repos/apibyexample/abe-python/issues{/number}","pulls_url":"https://api.github.com/repos/apibyexample/abe-python/pulls{/number}","milestones_url":"https://api.github.com/repos/apibyexample/abe-python/milestones{/number}","notifications_url":"https://api.github.com/repos/apibyexample/abe-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apibyexample/abe-python/labels{/name}","releases_url":"https://api.github.com/repos/apibyexample/abe-python/releases{/id}","created_at":"2014-09-01T12:57:23Z","updated_at":"2015-06-04T13:35:24Z","pushed_at":"2015-11-19T09:21:57Z","git_url":"git://github.com/apibyexample/abe-python.git","ssh_url":"git@github.com:apibyexample/abe-python.git","clone_url":"https://github.com/apibyexample/abe-python.git","svn_url":"https://github.com/apibyexample/abe-python","homepage":null,"size":31,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/14"},"html":{"href":"https://github.com/apibyexample/abe-python/pull/14"},"issue":{"href":"https://api.github.com/repos/apibyexample/abe-python/issues/14"},"comments":{"href":"https://api.github.com/repos/apibyexample/abe-python/issues/14/comments"},"review_comments":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/14/comments"},"review_comment":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apibyexample/abe-python/pulls/14/commits"},"statuses":{"href":"https://api.github.com/repos/apibyexample/abe-python/statuses/aac0c02d45d3115718231a57bed619df26d91476"}}}}