(self, pytester: Pytester)
| 722 | |
| 723 | class TestSorting: |
| 724 | def test_check_equality(self, pytester: Pytester) -> None: |
| 725 | modcol = pytester.getmodulecol( |
| 726 | """ |
| 727 | def test_pass(): pass |
| 728 | def test_fail(): assert 0 |
| 729 | """ |
| 730 | ) |
| 731 | fn1 = pytester.collect_by_name(modcol, "test_pass") |
| 732 | assert isinstance(fn1, pytest.Function) |
| 733 | fn2 = pytester.collect_by_name(modcol, "test_pass") |
| 734 | assert isinstance(fn2, pytest.Function) |
| 735 | |
| 736 | assert fn1 == fn2 |
| 737 | assert fn1 != modcol |
| 738 | assert hash(fn1) == hash(fn2) |
| 739 | |
| 740 | fn3 = pytester.collect_by_name(modcol, "test_fail") |
| 741 | assert isinstance(fn3, pytest.Function) |
| 742 | assert not (fn1 == fn3) |
| 743 | assert fn1 != fn3 |
| 744 | |
| 745 | for fn in fn1, fn2, fn3: |
| 746 | assert fn != 3 # type: ignore[comparison-overlap] |
| 747 | assert fn != modcol |
| 748 | assert fn != [1, 2, 3] # type: ignore[comparison-overlap] |
| 749 | assert [1, 2, 3] != fn # type: ignore[comparison-overlap] |
| 750 | assert modcol != fn |
| 751 | |
| 752 | def test_allow_sane_sorting_for_decorators(self, pytester: Pytester) -> None: |
| 753 | modcol = pytester.getmodulecol( |
nothing calls this directly
no test coverage detected