(pytester: Pytester)
| 1558 | |
| 1559 | @pytest.mark.filterwarnings("default") |
| 1560 | def test_assert_tuple_warning(pytester: Pytester) -> None: |
| 1561 | msg = "assertion is always true" |
| 1562 | pytester.makepyfile( |
| 1563 | """ |
| 1564 | def test_tuple(): |
| 1565 | assert(False, 'you shall not pass') |
| 1566 | """ |
| 1567 | ) |
| 1568 | result = pytester.runpytest() |
| 1569 | result.stdout.fnmatch_lines([f"*test_assert_tuple_warning.py:2:*{msg}*"]) |
| 1570 | |
| 1571 | # tuples with size != 2 should not trigger the warning |
| 1572 | pytester.makepyfile( |
| 1573 | """ |
| 1574 | def test_tuple(): |
| 1575 | assert () |
| 1576 | """ |
| 1577 | ) |
| 1578 | result = pytester.runpytest() |
| 1579 | assert msg not in result.stdout.str() |
| 1580 | |
| 1581 | |
| 1582 | def test_assert_indirect_tuple_no_warning(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected