コード例 #1
0
ファイル: test_main.py プロジェクト: zulcss/modernize
def test_enforce():
    check_on_input(
        NO_SIX_SAMPLE,
        EXPECTED_SIX_RESULT,
        extra_flags=["--enforce"],
        expected_return_code=2,
    )
コード例 #2
0
def test_urllib_import_as():
    check_on_input(*URLLIB_IMPORT_AS)
コード例 #3
0
def test_next_method():
    check_on_input(*NEXT_METHOD)
コード例 #4
0
def test_unicode_type_call():
    check_on_input(*UNICODE_TYPE_CALL)
コード例 #5
0
def test_map_ref():
    check_on_input(*MAP_REF)
コード例 #6
0
def test_optional():
    check_on_input(CLASSIC_DIVISION[0], CLASSIC_DIVISION[0])
コード例 #7
0
def test_raise_string():
    check_on_input(*RAISE_STRING)
コード例 #8
0
def test_raise():
    check_on_input(*RAISE)
コード例 #9
0
def check_all_types(input, output):
    for type_ in TYPES:
        check_on_input(input.format(type=type_), output.format(type=type_))
コード例 #10
0
def test_normal_and_future_imports():
    check_on_input(*NORMAL_AND_FUTURE_IMPORTS)
コード例 #11
0
def test_only_normal_imports():
    check_on_input(*ONLY_NORMAL_IMPORTS)
コード例 #12
0
def test_only_future_imports():
    check_on_input(*ONLY_FUTURE_IMPORTS)
コード例 #13
0
def test_no_imports():
    check_on_input(*NO_IMPORTS)
コード例 #14
0
def test_next_nested():
    check_on_input(*NEXT_NESTED)
コード例 #15
0
def test_next_method():
    check_on_input(*NEXT_METHOD)
コード例 #16
0
def test_future_import_as():
    check_on_input(*FUTURE_IMPORT_AS)
コード例 #17
0
def test_dict_in_loop():
    check_on_input(*DICT_IN_LOOP)
コード例 #18
0
def test_raise_value():
    check_on_input(*RAISE_VALUE)
コード例 #19
0
def test_unicode_six():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_six, extra_flags=['--six-unicode'])
コード例 #20
0
def test_unicode_type_ref():
    check_on_input(*UNICODE_TYPE_REF)
コード例 #21
0
def test_unicode_compat():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_compat)
コード例 #22
0
def test_map_1_arg():
    check_on_input(*MAP_1_ARG)
コード例 #23
0
def test_unicode_future():
    check_on_input(UNICODE_LITERALS, UNICODE_LITERALS_future, extra_flags=['--future-unicode'])
コード例 #24
0
def test_map_lambda():
    check_on_input(*MAP_LAMBDA)
コード例 #25
0
def test_open():
    check_on_input(OPEN[0].format('open'), OPEN[1],
                   extra_flags=['-f', 'libmodernize.fixes.fix_open'])
コード例 #26
0
def test_future_import_as_multiple():
    check_on_input(*FUTURE_IMPORT_AS_MULTIPLE)
コード例 #27
0
def test_open_optional():
    check_on_input(OPEN[0].format('open'), OPEN[0].format('open'))
コード例 #28
0
def test_urllib_multi_import():
    check_on_input(*URLLIB_MULTI_IMPORT_REFERENCE)
コード例 #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)
コード例 #30
0
def test_urllib_invalid_imports():
    check_on_input(*URLIB_INVALID_CODE)
コード例 #31
0
def test_raise_traceback():
    check_on_input(*RAISE_TRACEBACK)
コード例 #32
0
def test_next_nested():
    check_on_input(*NEXT_NESTED)
コード例 #33
0
def test_future_import_paren():
    check_on_input(*FUTURE_IMPORT_PAREN)
コード例 #34
0
def test_future_import_as_multiple():
    check_on_input(*FUTURE_IMPORT_AS_MULTIPLE)
コード例 #35
0
def test_input():
    check_on_input(*INPUT)
コード例 #36
0
def test_raise_exc():
    check_on_input(*RAISE_EXC)
コード例 #37
0
def test_input_args():
    check_on_input(*INPUT_ARGS)
コード例 #38
0
def test_raise_tuple():
    check_on_input(*RAISE_TUPLE)
コード例 #39
0
def test_raw_input_trailer():
    check_on_input(*RAW_INPUT_TRAILER)
コード例 #40
0
def test_raise_tuple_args():
    check_on_input(*RAISE_TUPLE_ARGS)
コード例 #41
0
def test_raw_input_input():
    check_on_input(*RAW_INPUT_INPUT)
コード例 #42
0
def test_unicode_type_call():
    check_on_input(*UNICODE_TYPE_CALL)
コード例 #43
0
def test_metaclass_no_base_parens():
    check_on_input(*METACLASS_NO_BASE_PARENS)
コード例 #44
0
def test_new_division():
    check_on_input(
        *NEW_DIVISION, extra_flags=["-f", "libmodernize.fixes.fix_classic_division"]
    )
コード例 #45
0
def test_metaclass_single_base():
    check_on_input(*METACLASS_SINGLE_BASE)
コード例 #46
0
def test_map_4_args():
    check_on_input(*MAP_4_ARGS)
コード例 #47
0
def test_metaclass_many_bases():
    check_on_input(*METACLASS_MANY_BASES)
コード例 #48
0
def test_map_iterator_context():
    check_on_input(*MAP_ITERATOR_CONTEXT)
コード例 #49
0
def test_metaclass_one_liner():
    check_on_input(*METACLASS_ONE_LINER)
コード例 #50
0
def test_unicode_type_ref():
    check_on_input(*UNICODE_TYPE_REF)
コード例 #51
0
def test_urllib_module_reference():
    check_on_input(*URLLIB_MODULE_REFERENCE)
コード例 #52
0
def test_future_import_as():
    check_on_input(*FUTURE_IMPORT_AS)
コード例 #53
0
def test_urllib_function_reference():
    check_on_input(*URLLIB_FUNCTION_REFERENCE)
コード例 #54
0
def test_future_import_paren():
    check_on_input(*FUTURE_IMPORT_PAREN)
コード例 #55
0
def test_file_ref():
    check_on_input(*FILE_REF)