{"action":"created","comment":{"url":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments/68366789","id":68366789,"diff_hunk":"@@ -3,4 +3,58 @@\n Repeating tests with parametrize\n ================================\n \n-TODO\n+pytest support test parametrization using a builtin ``pytest.mark.parametrize``\n+decorator, which enables parametrization of arguments for a test function.\n+\n+Here is a typical example of a test function that implements checking that a\n+certain input leads to an expected output::\n+\n+    # content of test_expectation.py\n+    import pytest\n+    @pytest.mark.parametrize(\"test_input,expected\", [\n+        (\"3+5\", 8),\n+        (\"2+4\", 6),\n+        (\"6*9\", 42),\n+    ])\n+    def test_eval(test_input, expected):\n+        assert eval(test_input) == expected\n+\n+Here, the ``@pytest.mark.parametrize`` decorator defines three different\n+``(test_input,expected)`` tuples so that the ``test_eval`` function will run\n+three times using them in turn. Note that the test arguments must match the\n+comma-separated values provided in the decorator::\n+\n+    $ py.test\n+    ======= test session starts ========\n+    platform linux -- Python 3.5.1, pytest-2.9.2, py-1.4.31, pluggy-0.3.1\n+    rootdir: $REGENDOC_TMPDIR, inifile:\n+    collected 3 items\n+\n+    test_expectation.py ..F\n+\n+    ======= FAILURES ========\n+    _______ test_eval[6*9-42] ________\n+\n+    test_input = '6*9', expected = 42\n+\n+        @pytest.mark.parametrize(\"test_input,expected\", [\n+            (\"3+5\", 8),\n+            (\"2+4\", 6),\n+            (\"6*9\", 42),\n+        ])\n+        def test_eval(test_input, expected):\n+    >       assert eval(test_input) == expected\n+    E       assert 54 == 42\n+    E        +  where 54 = eval('6*9')\n+\n+    test_expectation.py:8: AssertionError\n+    ======= 1 failed, 2 passed in 0.12 seconds ========\n+\n+As designed in this example, only one pair of input/output values fails\n+the simple test function.  And as usual with test function arguments,\n+you can see the ``input`` and ``output`` values in the traceback.","path":"doc/en/new-docs/user/parametrize.rst","position":54,"original_position":54,"commit_id":"db324892d5d32960112a626540c6fe19fb8d7c39","original_commit_id":"db324892d5d32960112a626540c6fe19fb8d7c39","user":{"login":"nicoddemus","id":1085180,"avatar_url":"https://avatars.githubusercontent.com/u/1085180?v=3","gravatar_id":"","url":"https://api.github.com/users/nicoddemus","html_url":"https://github.com/nicoddemus","followers_url":"https://api.github.com/users/nicoddemus/followers","following_url":"https://api.github.com/users/nicoddemus/following{/other_user}","gists_url":"https://api.github.com/users/nicoddemus/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoddemus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoddemus/subscriptions","organizations_url":"https://api.github.com/users/nicoddemus/orgs","repos_url":"https://api.github.com/users/nicoddemus/repos","events_url":"https://api.github.com/users/nicoddemus/events{/privacy}","received_events_url":"https://api.github.com/users/nicoddemus/received_events","type":"User","site_admin":false},"body":"Agree, @davehunt could you fix this so we can merge it? :grin: ","created_at":"2016-06-24T08:13:45Z","updated_at":"2016-06-24T08:13:45Z","html_url":"https://github.com/pytest-dev/pytest/pull/1646#discussion_r68366789","pull_request_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646","_links":{"self":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments/68366789"},"html":{"href":"https://github.com/pytest-dev/pytest/pull/1646#discussion_r68366789"},"pull_request":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646"}}},"pull_request":{"url":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646","id":74801416,"html_url":"https://github.com/pytest-dev/pytest/pull/1646","diff_url":"https://github.com/pytest-dev/pytest/pull/1646.diff","patch_url":"https://github.com/pytest-dev/pytest/pull/1646.patch","issue_url":"https://api.github.com/repos/pytest-dev/pytest/issues/1646","number":1646,"state":"open","locked":false,"title":"Add basic user documentation for parametrizing tests","user":{"login":"davehunt","id":122800,"avatar_url":"https://avatars.githubusercontent.com/u/122800?v=3","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-22T15:08:52Z","updated_at":"2016-06-24T08:13:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"af508ff27a94397568050c6c186fa3abe6e6f15f","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646/commits","review_comments_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646/comments","review_comment_url":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/issues/1646/comments","statuses_url":"https://api.github.com/repos/pytest-dev/pytest/statuses/db324892d5d32960112a626540c6fe19fb8d7c39","head":{"label":"davehunt:reorganize-docs","ref":"reorganize-docs","sha":"db324892d5d32960112a626540c6fe19fb8d7c39","user":{"login":"davehunt","id":122800,"avatar_url":"https://avatars.githubusercontent.com/u/122800?v=3","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"repo":{"id":48173651,"name":"pytest","full_name":"davehunt/pytest","owner":{"login":"davehunt","id":122800,"avatar_url":"https://avatars.githubusercontent.com/u/122800?v=3","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/davehunt/pytest","description":"The pytest testing tool makes it easy to write small tests, yet scales to support complex functional testing","fork":true,"url":"https://api.github.com/repos/davehunt/pytest","forks_url":"https://api.github.com/repos/davehunt/pytest/forks","keys_url":"https://api.github.com/repos/davehunt/pytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/davehunt/pytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/davehunt/pytest/teams","hooks_url":"https://api.github.com/repos/davehunt/pytest/hooks","issue_events_url":"https://api.github.com/repos/davehunt/pytest/issues/events{/number}","events_url":"https://api.github.com/repos/davehunt/pytest/events","assignees_url":"https://api.github.com/repos/davehunt/pytest/assignees{/user}","branches_url":"https://api.github.com/repos/davehunt/pytest/branches{/branch}","tags_url":"https://api.github.com/repos/davehunt/pytest/tags","blobs_url":"https://api.github.com/repos/davehunt/pytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/davehunt/pytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/davehunt/pytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/davehunt/pytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/davehunt/pytest/statuses/{sha}","languages_url":"https://api.github.com/repos/davehunt/pytest/languages","stargazers_url":"https://api.github.com/repos/davehunt/pytest/stargazers","contributors_url":"https://api.github.com/repos/davehunt/pytest/contributors","subscribers_url":"https://api.github.com/repos/davehunt/pytest/subscribers","subscription_url":"https://api.github.com/repos/davehunt/pytest/subscription","commits_url":"https://api.github.com/repos/davehunt/pytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/davehunt/pytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/davehunt/pytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/davehunt/pytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/davehunt/pytest/contents/{+path}","compare_url":"https://api.github.com/repos/davehunt/pytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/davehunt/pytest/merges","archive_url":"https://api.github.com/repos/davehunt/pytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/davehunt/pytest/downloads","issues_url":"https://api.github.com/repos/davehunt/pytest/issues{/number}","pulls_url":"https://api.github.com/repos/davehunt/pytest/pulls{/number}","milestones_url":"https://api.github.com/repos/davehunt/pytest/milestones{/number}","notifications_url":"https://api.github.com/repos/davehunt/pytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/davehunt/pytest/labels{/name}","releases_url":"https://api.github.com/repos/davehunt/pytest/releases{/id}","deployments_url":"https://api.github.com/repos/davehunt/pytest/deployments","created_at":"2015-12-17T12:38:30Z","updated_at":"2015-12-17T12:38:31Z","pushed_at":"2016-06-22T15:05:54Z","git_url":"git://github.com/davehunt/pytest.git","ssh_url":"git@github.com:davehunt/pytest.git","clone_url":"https://github.com/davehunt/pytest.git","svn_url":"https://github.com/davehunt/pytest","homepage":"http://pytest.org/","size":7882,"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":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytest-dev:reorganize-docs","ref":"reorganize-docs","sha":"580cc183389a2d799d6dacfe59ab2afd7064b064","user":{"login":"pytest-dev","id":8897583,"avatar_url":"https://avatars.githubusercontent.com/u/8897583?v=3","gravatar_id":"","url":"https://api.github.com/users/pytest-dev","html_url":"https://github.com/pytest-dev","followers_url":"https://api.github.com/users/pytest-dev/followers","following_url":"https://api.github.com/users/pytest-dev/following{/other_user}","gists_url":"https://api.github.com/users/pytest-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pytest-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytest-dev/subscriptions","organizations_url":"https://api.github.com/users/pytest-dev/orgs","repos_url":"https://api.github.com/users/pytest-dev/repos","events_url":"https://api.github.com/users/pytest-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pytest-dev/received_events","type":"Organization","site_admin":false},"repo":{"id":37489525,"name":"pytest","full_name":"pytest-dev/pytest","owner":{"login":"pytest-dev","id":8897583,"avatar_url":"https://avatars.githubusercontent.com/u/8897583?v=3","gravatar_id":"","url":"https://api.github.com/users/pytest-dev","html_url":"https://github.com/pytest-dev","followers_url":"https://api.github.com/users/pytest-dev/followers","following_url":"https://api.github.com/users/pytest-dev/following{/other_user}","gists_url":"https://api.github.com/users/pytest-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/pytest-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytest-dev/subscriptions","organizations_url":"https://api.github.com/users/pytest-dev/orgs","repos_url":"https://api.github.com/users/pytest-dev/repos","events_url":"https://api.github.com/users/pytest-dev/events{/privacy}","received_events_url":"https://api.github.com/users/pytest-dev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pytest-dev/pytest","description":"The pytest framework makes it easy to write small tests, yet scales to support complex functional testing","fork":false,"url":"https://api.github.com/repos/pytest-dev/pytest","forks_url":"https://api.github.com/repos/pytest-dev/pytest/forks","keys_url":"https://api.github.com/repos/pytest-dev/pytest/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytest-dev/pytest/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytest-dev/pytest/teams","hooks_url":"https://api.github.com/repos/pytest-dev/pytest/hooks","issue_events_url":"https://api.github.com/repos/pytest-dev/pytest/issues/events{/number}","events_url":"https://api.github.com/repos/pytest-dev/pytest/events","assignees_url":"https://api.github.com/repos/pytest-dev/pytest/assignees{/user}","branches_url":"https://api.github.com/repos/pytest-dev/pytest/branches{/branch}","tags_url":"https://api.github.com/repos/pytest-dev/pytest/tags","blobs_url":"https://api.github.com/repos/pytest-dev/pytest/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytest-dev/pytest/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytest-dev/pytest/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytest-dev/pytest/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytest-dev/pytest/statuses/{sha}","languages_url":"https://api.github.com/repos/pytest-dev/pytest/languages","stargazers_url":"https://api.github.com/repos/pytest-dev/pytest/stargazers","contributors_url":"https://api.github.com/repos/pytest-dev/pytest/contributors","subscribers_url":"https://api.github.com/repos/pytest-dev/pytest/subscribers","subscription_url":"https://api.github.com/repos/pytest-dev/pytest/subscription","commits_url":"https://api.github.com/repos/pytest-dev/pytest/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytest-dev/pytest/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytest-dev/pytest/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytest-dev/pytest/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytest-dev/pytest/contents/{+path}","compare_url":"https://api.github.com/repos/pytest-dev/pytest/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytest-dev/pytest/merges","archive_url":"https://api.github.com/repos/pytest-dev/pytest/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytest-dev/pytest/downloads","issues_url":"https://api.github.com/repos/pytest-dev/pytest/issues{/number}","pulls_url":"https://api.github.com/repos/pytest-dev/pytest/pulls{/number}","milestones_url":"https://api.github.com/repos/pytest-dev/pytest/milestones{/number}","notifications_url":"https://api.github.com/repos/pytest-dev/pytest/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytest-dev/pytest/labels{/name}","releases_url":"https://api.github.com/repos/pytest-dev/pytest/releases{/id}","deployments_url":"https://api.github.com/repos/pytest-dev/pytest/deployments","created_at":"2015-06-15T20:28:27Z","updated_at":"2016-06-22T15:33:46Z","pushed_at":"2016-06-24T08:08:27Z","git_url":"git://github.com/pytest-dev/pytest.git","ssh_url":"git@github.com:pytest-dev/pytest.git","clone_url":"https://github.com/pytest-dev/pytest.git","svn_url":"https://github.com/pytest-dev/pytest","homepage":"http://pytest.org/","size":10215,"stargazers_count":748,"watchers_count":748,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":194,"mirror_url":null,"open_issues_count":332,"forks":194,"open_issues":332,"watchers":748,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646"},"html":{"href":"https://github.com/pytest-dev/pytest/pull/1646"},"issue":{"href":"https://api.github.com/repos/pytest-dev/pytest/issues/1646"},"comments":{"href":"https://api.github.com/repos/pytest-dev/pytest/issues/1646/comments"},"review_comments":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646/comments"},"review_comment":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytest-dev/pytest/pulls/1646/commits"},"statuses":{"href":"https://api.github.com/repos/pytest-dev/pytest/statuses/db324892d5d32960112a626540c6fe19fb8d7c39"}}}}
{"actor":{"display_login":"nicoddemus"}}