You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix for #54 - allow regexes when matching expected message text (#55)
* Some refactoring before making the change - use an object for expected output rather than a string.
* Simple regex case now working
* A spot of clean-up.
* Document regex option.
* Specify default value for regex flag.
* Add test for regexes inb out section.
* Add test to ensure that regexes ony run if the flag is switched on.
* Allow regexes on specific messages.
* Fix regex - single line flag froup needed to be optional.
* Add simple failing simple cases.
* Add case for mismatching regex.
| `case` | `str` | Name of the test case, complies to `[a-zA-Z0-9]` pattern |
58
-
| `main` | `str` | Portion of the code as if written in `.py` file |
59
-
| `files` | `Optional[List[File]]=[]`\* | List of extra files to simulate imports if needed |
60
-
| `disable_cache` | `Optional[bool]=False` | Set to `true` disables `mypy` caching |
61
-
| `mypy_config` | `Optional[Dict[str, Union[str, int, bool, float]]]={}` | Inline `mypy` configuration, passed directly to `mypy` as `--config-file` option |
62
-
| `env` | `Optional[Dict[str, str]]={}` | Environmental variables to be provided inside of test run |
63
-
| `parametrized` | `Optional[List[Parameter]]=[]`\* | List of parameters, similar to [`@pytest.mark.parametrize`](https://docs.pytest.org/en/stable/parametrize.html) |
64
-
| `skip` | `str` | Expression evaluated with following globals set: `sys`, `os`, `pytest` and `platform` |
| `case` | `str` | Name of the test case, complies to `[a-zA-Z0-9]` pattern |
58
+
| `main` | `str` | Portion of the code as if written in `.py` file |
59
+
| `files` | `Optional[List[File]]=[]`\* | List of extra files to simulate imports if needed |
60
+
| `disable_cache` | `Optional[bool]=False` | Set to `true` disables `mypy` caching |
61
+
| `mypy_config` | `Optional[Dict[str, Union[str, int, bool, float]]]={}` | Inline `mypy` configuration, passed directly to `mypy` as `--config-file` option |
62
+
| `env` | `Optional[Dict[str, str]]={}` | Environmental variables to be provided inside of test run |
63
+
| `parametrized` | `Optional[List[Parameter]]=[]`\* | List of parameters, similar to [`@pytest.mark.parametrize`](https://docs.pytest.org/en/stable/parametrize.html) |
64
+
| `skip` | `str` | Expression evaluated with following globals set: `sys`, `os`, `pytest` and `platform` |
65
+
| `regex` | `str` | Allow regular expressions in comments to be matched against actual output. Defaults to "no", i.e. matches full text.|
65
66
66
67
(*) Appendix to **pseudo** types used above:
67
68
@@ -126,6 +127,27 @@ Implementation notes:
126
127
main:1: note: Revealed type is 'builtins.str'
127
128
```
128
129
130
+
#### 4. Regular expressions in expectations
131
+
132
+
```yaml
133
+
- case: expected_message_regex_with_out
134
+
regex: yes
135
+
main: |
136
+
a = 'abc'
137
+
reveal_type(a)
138
+
out: |
139
+
main:2: note: .*str.*
140
+
```
141
+
142
+
#### 5. Regular expressions specific lines of output.
0 commit comments