File: test_no_bool_in_generic.py

package info (click to toggle)
pandas 1.5.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 56,516 kB
  • sloc: python: 382,477; ansic: 8,695; sh: 119; xml: 102; makefile: 97
file content (20 lines) | stat: -rw-r--r-- 573 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)"
GOOD_FILE = "def foo(a: bool_t) -> bool_t:\n    return bool(0)"


def test_bad_file_with_replace():
    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():
    content = GOOD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = content
    assert result == expected
    assert not mutated