File: test_sorting.py

package info (click to toggle)
vulture 2.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 464 kB
  • sloc: python: 3,254; makefile: 12
file content (24 lines) | stat: -rw-r--r-- 424 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from . import v

assert v  # Silence pyflakes


def test_sorting(v):
    v.scan(
        """\
def foo():
    print("Hello, I am a long function.")
    return "World"

def bar():
    pass
"""
    )
    assert [item.name for item in v.get_unused_code(sort_by_size=True)] == [
        "bar",
        "foo",
    ]
    assert [item.name for item in v.get_unused_code(sort_by_size=False)] == [
        "foo",
        "bar",
    ]