Example #1
0
def test_enforce():
    check_on_input(
        NO_SIX_SAMPLE,
        EXPECTED_SIX_RESULT,
        extra_flags=["--enforce"],
        expected_return_code=2,
    )
def test_urllib_import_as():
    check_on_input(*URLLIB_IMPORT_AS)
Example #3
0
def test_next_method():
    check_on_input(*NEXT_METHOD)
def test_unicode_type_call():
    check_on_input(*UNICODE_TYPE_CALL)
def test_map_ref():
    check_on_input(*MAP_REF)
Example #6
0
def test_optional():
    check_on_input(CLASSIC_DIVISION[0], CLASSIC_DIVISION[0])
Example #7
0
def test_raise_string():
    check_on_input(*RAISE_STRING)
Example #8
0
def test_raise():
    check_on_input(*RAISE)
def check_all_types(input, output):
    for type_ in TYPES:
        check_on_input(input.format(type=type_), output.format(type=type_))
Example #10
0
def test_normal_and_future_imports():
    check_on_input(*NORMAL_AND_FUTURE_IMPORTS)
Example #11
0
def test_only_normal_imports():
    check_on_input(*ONLY_NORMAL_IMPORTS)
Example #12
0
def test_only_future_imports():
    check_on_input(*ONLY_FUTURE_IMPORTS)
Example #13
0
def test_no_imports():
    check_on_input(*NO_IMPORTS)
Example #14
0
def test_next_nested():
    check_on_input(*NEXT_NESTED)
Example #15
0
def test_next_method():
    check_on_input(*NEXT_METHOD)
def test_future_import_as():
    check_on_input(*FUTURE_IMPORT_AS)
def test_dict_in_loop():
    check_on_input(*DICT_IN_LOOP)
Example #18
0
def test_raise_value():
    check_on_input(*RAISE_VALUE)
Example #19
0
def test_unicode_six():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_six, extra_flags=['--six-unicode'])
Example #20
0
def test_unicode_type_ref():
    check_on_input(*UNICODE_TYPE_REF)
Example #21
0
def test_unicode_compat():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_compat)
def test_map_1_arg():
    check_on_input(*MAP_1_ARG)
Example #23
0
def test_unicode_future():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_future, extra_flags=['--future-unicode'])
def test_map_lambda():
    check_on_input(*MAP_LAMBDA)
Example #25
0
def test_open():
    check_on_input(OPEN[0].format('open'), OPEN[1],
                   extra_flags=['-f', 'libmodernize.fixes.fix_open'])
Example #26
0
def test_future_import_as_multiple():
    check_on_input(*FUTURE_IMPORT_AS_MULTIPLE)
Example #27
0
def test_open_optional():
    check_on_input(OPEN[0].format('open'), OPEN[0].format('open'))
def test_urllib_multi_import():
    check_on_input(*URLLIB_MULTI_IMPORT_REFERENCE)
Example #29
0
def test_file():
    flags = ['-f', 'libmodernize.fixes.fix_open',
             '-f', 'libmodernize.fixes.fix_file']
    check_on_input(OPEN[0].format('file'), OPEN[1], extra_flags=flags)
def test_urllib_invalid_imports():
    check_on_input(*URLIB_INVALID_CODE)
def test_raise_traceback():
    check_on_input(*RAISE_TRACEBACK)
Example #32
0
def test_next_nested():
    check_on_input(*NEXT_NESTED)
def test_future_import_paren():
    check_on_input(*FUTURE_IMPORT_PAREN)
def test_future_import_as_multiple():
    check_on_input(*FUTURE_IMPORT_AS_MULTIPLE)
def test_input():
    check_on_input(*INPUT)
Example #36
0
def test_raise_exc():
    check_on_input(*RAISE_EXC)
def test_input_args():
    check_on_input(*INPUT_ARGS)
Example #38
0
def test_raise_tuple():
    check_on_input(*RAISE_TUPLE)
def test_raw_input_trailer():
    check_on_input(*RAW_INPUT_TRAILER)
Example #40
0
def test_raise_tuple_args():
    check_on_input(*RAISE_TUPLE_ARGS)
def test_raw_input_input():
    check_on_input(*RAW_INPUT_INPUT)
Example #42
0
def test_unicode_type_call():
    check_on_input(*UNICODE_TYPE_CALL)
Example #43
0
def test_metaclass_no_base_parens():
    check_on_input(*METACLASS_NO_BASE_PARENS)
Example #44
0
def test_new_division():
    check_on_input(
        *NEW_DIVISION, extra_flags=["-f", "libmodernize.fixes.fix_classic_division"]
    )
Example #45
0
def test_metaclass_single_base():
    check_on_input(*METACLASS_SINGLE_BASE)
def test_map_4_args():
    check_on_input(*MAP_4_ARGS)
Example #47
0
def test_metaclass_many_bases():
    check_on_input(*METACLASS_MANY_BASES)
def test_map_iterator_context():
    check_on_input(*MAP_ITERATOR_CONTEXT)
Example #49
0
def test_metaclass_one_liner():
    check_on_input(*METACLASS_ONE_LINER)
def test_unicode_type_ref():
    check_on_input(*UNICODE_TYPE_REF)
def test_urllib_module_reference():
    check_on_input(*URLLIB_MODULE_REFERENCE)
Example #52
0
def test_future_import_as():
    check_on_input(*FUTURE_IMPORT_AS)
def test_urllib_function_reference():
    check_on_input(*URLLIB_FUNCTION_REFERENCE)
Example #54
0
def test_future_import_paren():
    check_on_input(*FUTURE_IMPORT_PAREN)
Example #55
0
def test_file_ref():
    check_on_input(*FILE_REF)