Пример #1
0
def test_no_duplicate_futures_annotations():
    """
    Originally forgot to check for existing futures imports before adding a new one.

    Creating this to avoid this in the future.
    """
    int_test(example, expected, futures=True, expect_futures=False)
def test_no_docstring_with_missing_future():
    example = '''from typing import List
x: List
'''

    expected = '''from __future__ import annotations

x: list
    '''
    int_test(example, expected, futures=True, expect_futures=False)
Пример #3
0
def test_format_function_definition():
    int_test(definition, expected)
    int_test(definition, expected, futures=True)
def test_format_variables():
    int_test(variables_definition, expectd)
    int_test(variables_definition, expectd, futures=True)
def test_empty_file_with_missing_future():
    example = '""'

    expected = '''from __future__ import annotations'''
    int_test(example, expected, futures=True, expect_futures=False)
Пример #6
0
def test_generator():
    int_test(example, expected, futures=True)