File: test_no_bool_in_generic.py

package info (click to toggle)
pandas 2.2.3%2Bdfsg-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 66,784 kB
  • sloc: python: 422,228; ansic: 9,190; sh: 270; xml: 102; makefile: 83
file content (20 lines) | stat: -rw-r--r-- 593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from scripts.no_bool_in_generic import check_for_bool_in_generic

BAD_FILE = "def foo(a: bool) -> bool:\n    return bool(0)\n"
GOOD_FILE = "def foo(a: bool_t) -> bool_t:\n    return bool(0)\n"


def test_bad_file_with_replace() -> None:
    content = BAD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = GOOD_FILE
    assert result == expected
    assert mutated


def test_good_file_with_replace() -> None:
    content = GOOD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = content
    assert result == expected
    assert not mutated