Example #1
0
def test_builtins_dedent_coverage():
    s = ("if True:\n"
         "    if True:\n"
         "        min(d.keys())\n"
         "    else:\n"
         "        pass\n")

    # fmt:off
    expected = ("if True:\n"
                "    if True:\n"
                "        min(d)\n"
                "    else:\n"
                "        pass\n")
    # fmt:on

    assert _fix(s) == expected
Example #2
0
def test_for_noop(s):
    assert _fix(s) == s
Example #3
0
def test_for(s, expected):
    assert _fix(s) == expected
Example #4
0
def test_zip_noop(s):
    assert _fix(s) == s
Example #5
0
def test_zip(s, expected):
    assert _fix(s) == expected
Example #6
0
def test_builtins(func):
    s = f"{func}(d.keys())"
    assert _fix(s) == f"{func}(d)"
Example #7
0
def test_builtins_noop(s):
    assert _fix(s) == s
Example #8
0
def test_comprehensions(s, expected):
    assert _fix(s) == expected
Example #9
0
def test_builtins_complex(s, expected):
    assert _fix(s) == expected
Example #10
0
def test_builtins_brace_counting():
    s = "min(d((1, 2)).keys())"
    assert _fix(s) == "min(d((1, 2)))"
Example #11
0
File: in_test.py Project: mxr/unkey
def test_in_noop(s):
    # don't have a great way to detect these
    assert _fix(s) == s
Example #12
0
def test_join(s, expected):
    assert _fix(s) == expected
Example #13
0
def test_builtins(func):
    s = f"{func}({{1: 2, 3: 4}}.keys())"
    assert _fix(s) == f"{func}({{1: 2, 3: 4}})"
Example #14
0
def test_builtins_brace_counting():
    s = "min({1: 2, 3: {4, \n5, 6}, 7: {8: 9}}.keys())"
    assert _fix(s) == "min({1: 2, 3: {4, \n5, 6}, 7: {8: 9}})"