|
1 | 1 | import collections.abc as collections_abc
|
2 | 2 | import sys
|
3 | 3 | import textwrap
|
| 4 | +from typing import Any |
| 5 | +from typing import List |
| 6 | +from typing import Optional |
4 | 7 |
|
5 | 8 | import attr
|
6 | 9 |
|
@@ -310,9 +313,13 @@ def test_check(list):
|
310 | 313 | result.stdout.fnmatch_lines(["*test_hello*FAIL*", "*test_check*PASS*"])
|
311 | 314 |
|
312 | 315 |
|
313 |
| -def callequal(left, right, verbose=0): |
| 316 | +def callop(op: str, left: Any, right: Any, verbose: int = 0) -> Optional[List[str]]: |
314 | 317 | config = mock_config(verbose=verbose)
|
315 |
| - return plugin.pytest_assertrepr_compare(config, "==", left, right) |
| 318 | + return plugin.pytest_assertrepr_compare(config, op, left, right) |
| 319 | + |
| 320 | + |
| 321 | +def callequal(left: Any, right: Any, verbose: int = 0) -> Optional[List[str]]: |
| 322 | + return callop("==", left, right, verbose) |
316 | 323 |
|
317 | 324 |
|
318 | 325 | class TestAssert_reprcompare:
|
@@ -1068,10 +1075,13 @@ def test_rewritten():
|
1068 | 1075 | assert testdir.runpytest().ret == 0
|
1069 | 1076 |
|
1070 | 1077 |
|
1071 |
| -def test_reprcompare_notin(): |
1072 |
| - config = mock_config() |
1073 |
| - detail = plugin.pytest_assertrepr_compare(config, "not in", "foo", "aaafoobbb")[1:] |
1074 |
| - assert detail == ["'foo' is contained here:", " aaafoobbb", "? +++"] |
| 1078 | +def test_reprcompare_notin() -> None: |
| 1079 | + assert callop("not in", "foo", "aaafoobbb") == [ |
| 1080 | + "'foo' not in 'aaafoobbb'", |
| 1081 | + "'foo' is contained here:", |
| 1082 | + " aaafoobbb", |
| 1083 | + "? +++", |
| 1084 | + ] |
1075 | 1085 |
|
1076 | 1086 |
|
1077 | 1087 | def test_reprcompare_whitespaces():
|
|
0 commit comments