{"action":"created","issue":{"url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/130","repository_url":"https://api.github.com/repos/BurntSushi/quickcheck","labels_url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/130/labels{/name}","comments_url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/130/comments","events_url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/130/events","html_url":"https://github.com/BurntSushi/quickcheck/issues/130","id":152031656,"number":130,"title":"Feature Idea: Explicit test cases","user":{"login":"shepmaster","id":174509,"avatar_url":"https://avatars.githubusercontent.com/u/174509?v=3","gravatar_id":"","url":"https://api.github.com/users/shepmaster","html_url":"https://github.com/shepmaster","followers_url":"https://api.github.com/users/shepmaster/followers","following_url":"https://api.github.com/users/shepmaster/following{/other_user}","gists_url":"https://api.github.com/users/shepmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/shepmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shepmaster/subscriptions","organizations_url":"https://api.github.com/users/shepmaster/orgs","repos_url":"https://api.github.com/users/shepmaster/repos","events_url":"https://api.github.com/users/shepmaster/events{/privacy}","received_events_url":"https://api.github.com/users/shepmaster/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-04-30T14:01:31Z","updated_at":"2016-07-22T23:59:27Z","closed_at":null,"body":"While reading [Property-based Testing using Hypothesis in Python](https://elliot.land/unit-tests-that-write-themselves-hypothesis-python), I noticed this code:\r\n\r\n```python\r\n@given(text())\r\n@example('')\r\ndef test_decode_inverts_encode(s):\r\n    assert decode(encode(s)) == s\r\n```\r\n\r\nWhat I find clever is the `@example` bit. When quickcheck finds a problem, I usually end up copy-pasting the body of the test and then hardcoding the witness. However, if there were some way of extending the list of inputs with hardcoded values, that could make that case a bit easier sometimes.\r\n\r\nThe Python syntax matches most closely to a Rust attribute:\r\n\r\n```rust\r\n#[quickcheck]\r\n#[quickcheck_example(vec![], \"no values\")]\r\nfn double_reversal_is_identity(xs: Vec<isize>) -> bool {\r\n    xs == reverse(&reverse(&xs))\r\n}\r\n```\r\n\r\n(I took the opportunity to extend it with a string describing the test case)"},"comment":{"url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/comments/234684448","html_url":"https://github.com/BurntSushi/quickcheck/issues/130#issuecomment-234684448","issue_url":"https://api.github.com/repos/BurntSushi/quickcheck/issues/130","id":234684448,"user":{"login":"Eh2406","id":3709504,"avatar_url":"https://avatars.githubusercontent.com/u/3709504?v=3","gravatar_id":"","url":"https://api.github.com/users/Eh2406","html_url":"https://github.com/Eh2406","followers_url":"https://api.github.com/users/Eh2406/followers","following_url":"https://api.github.com/users/Eh2406/following{/other_user}","gists_url":"https://api.github.com/users/Eh2406/gists{/gist_id}","starred_url":"https://api.github.com/users/Eh2406/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Eh2406/subscriptions","organizations_url":"https://api.github.com/users/Eh2406/orgs","repos_url":"https://api.github.com/users/Eh2406/repos","events_url":"https://api.github.com/users/Eh2406/events{/privacy}","received_events_url":"https://api.github.com/users/Eh2406/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T23:59:27Z","updated_at":"2016-07-22T23:59:27Z","body":"Hypothesis has 2 great features that are related to this.  \r\n\r\n1. You can add an example to be run within the quickcheck process as a decorator.  See the OP for examples. \r\n\r\n2. It saves all failing test to a file to ensure that they get run again in the next test session."}}
{"actor":{"display_login":"Eh2406"}}