File: test-regex-assertions.yml

package info (click to toggle)
pytest-mypy-plugins 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: python: 1,287; sh: 15; makefile: 3
file content (75 lines) | stat: -rw-r--r-- 1,754 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
- case: expected_message_regex
  regex: yes
  main: |
    a = 1
    b = 'hello'

    reveal_type(a)  # N: Revealed type is "builtins.int"
    reveal_type(b)  # N: .*str.*

- case: expected_message_regex_with_out
  regex: yes
  main: |
    a = 'abc'
    reveal_type(a)
  out: |
    main:2: note: .*str.*

- case: regex_with_out_does_not_hang
  expect_fail: yes
  regex: yes
  main: |
    'abc'.split(4)
  out: |
    main:1: error: Argument 1 to "split" of "str" has incompatible type "int"; expected "Optional[str]"

- case: regex_with_comment_does_not_hang
  expect_fail: yes
  regex: yes
  main: |
    a = 'abc'.split(4)  # E: Argument 1 to "split" of "str" has incompatible type "int"; expected "Optional[str]"

- case: expected_single_message_regex
  regex: no
  main: |
    a = 'hello'
    reveal_type(a)  # NR: .*str.*

- case: rexex_but_not_turned_on
  expect_fail: yes
  main: |
    a = 'hello'
    reveal_type(a)  # N: .*str.*

- case: rexex_but_turned_off
  expect_fail: yes
  regex: no
  main: |
    a = 'hello'
    reveal_type(a)  # N: .*str.*

- case: regex_does_not_match
  expect_fail: yes
  regex: no
  main: |
    a = 'hello'
    reveal_type(a)  # NR: .*banana.*

- case: regex_against_callable_comment
  main: |
    from typing import Set, Union

    def foo(bar: str, ham: int = 42) -> Set[Union[str, int]]:
      return {bar, ham}
    reveal_type(foo)  # NR: Revealed type is "def \(bar: builtins\.str, ham: builtins\.int =\) -> .*"

- case: regex_against_callable_out
  regex: yes
  main: |
    from typing import Set, Union

    def foo(bar: str, ham: int = 42) -> Set[Union[str, int]]:
      return {bar, ham}
    reveal_type(foo)
  out: |
    main:5: note: Revealed type is "def \(bar: builtins\.str, ham: builtins\.int =\) -> .*"