Пример #1
0
    def test_format_docstrings(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO('''
def f():
    """
    triple-quoted docstring
    with multiple lines

    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
''')
        main(host, ['-'])
        self.assertMultiLineEqual(
            host.stdout.getvalue(), '''
def f():
    """triple-quoted docstring
    with multiple lines
    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
''')
Пример #2
0
    def test_format_docstrings(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO(
            '''
def f():
    """
    triple-quoted docstring
    with multiple lines

    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
'''
        )
        main(host, ["-"])
        self.assertMultiLineEqual(
            host.stdout.getvalue(),
            '''
def f():
    """triple-quoted docstring
    with multiple lines
    """
    x = """
    this is a regular multi-line string, not a docstring
    """
    return x
''',
        )
Пример #3
0
    def test_format_docstrings_indentation(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO('''
def f():
    """This is a docstring
       With extra indentation on this line.

     """
''')
        main(host, ['-'])
        self.assertMultiLineEqual(
            host.stdout.getvalue(), '''
def f():
    """This is a docstring
       With extra indentation on this line.
    """
''')
Пример #4
0
    def test_format_docstrings_indentation(self):
        host = MockSystemHost()
        host.stdin = StringIO.StringIO(
            '''
def f():
    """This is a docstring
       With extra indentation on this line.

     """
'''
        )
        main(host, ["-"])
        self.assertMultiLineEqual(
            host.stdout.getvalue(),
            '''
def f():
    """This is a docstring
       With extra indentation on this line.
    """
''',
        )
Пример #5
0
 def test_stdin_no_changes(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ['--no-autopep8', '--leave-strings-alone', '-'])
     self.assertMultiLineEqual(host.stdout.getvalue(), ACTUAL_INPUT)
Пример #6
0
 def test_stdin_chromium(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ['--chromium', '-'])
     self.assertMultiLineEqual(host.stdout.getvalue(),
                               EXPECTED_CHROMIUM_OUTPUT)
Пример #7
0
 def test_stdin_blink(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ['-'])
     self.assertMultiLineEqual(host.stdout.getvalue(),
                               EXPECTED_BLINK_OUTPUT)
Пример #8
0
 def test_stdin_only_double_quoting(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ['--no-autopep8', '--double-quote-strings', '-'])
     self.assertMultiLineEqual(host.stdout.getvalue(),
                               EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT)
Пример #9
0
 def test_stdin_only_double_quoting(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--no-autopep8", "--double-quote-strings", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_ONLY_DOUBLE_QUOTED_OUTPUT)
Пример #10
0
 def test_stdin_no_changes(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--no-autopep8", "--leave-strings-alone", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), ACTUAL_INPUT)
Пример #11
0
 def test_stdin_chromium(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["--chromium", "-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_CHROMIUM_OUTPUT)
Пример #12
0
 def test_stdin_blink(self):
     host = MockSystemHost()
     host.stdin = StringIO.StringIO(ACTUAL_INPUT)
     main(host, ["-"])
     self.assertMultiLineEqual(host.stdout.getvalue(), EXPECTED_BLINK_OUTPUT)