Beispiel #1
0
    def test_formatted(self):
        group = BaseImportGroup()
        group.statements = [
            ImportStatement([], 'b' * 80,
                            [ImportLeaf('c'), ImportLeaf('d')]),
            ImportStatement([], 'a')
        ]

        self.assertEqual(
            group.formatted(),
            'import a\n' + 'from {} import (\n'.format('b' * 80) + '    c,\n' +
            '    d,\n' + ')')
Beispiel #2
0
    def test_formatted(self):
        group = BaseImportGroup()
        group.statements = [
            ImportStatement([], "b" * 80,
                            [ImportLeaf("c"), ImportLeaf("d")]),
            ImportStatement([], "a"),
        ]

        self.assertEqual(
            group.formatted(),
            "import a\n" + "from {} import (\n".format("b" * 80) + "    c,\n" +
            "    d,\n" + ")",
        )
Beispiel #3
0
    def test_formatted_with_artifacts(self):
        artifacts = {'sep': '\r\n'}
        group = BaseImportGroup(file_artifacts=artifacts)
        group.statements = [
            ImportStatement(list(),
                            'b' * 80,
                            [ImportLeaf('c'), ImportLeaf('d')],
                            file_artifacts=artifacts),
            ImportStatement([], 'a', file_artifacts=artifacts)
        ]

        self.assertEqual(
            group.formatted(),
            'import a\r\n' + 'from {} import (\r\n'.format('b' * 80) +
            '    c,\r\n' + '    d,\r\n' + ')')
Beispiel #4
0
    def test_formatted(self):
        group = BaseImportGroup()
        group.statements = [
            ImportStatement([], "b" * 80, [ImportLeaf("c"), ImportLeaf("d")]),
            ImportStatement([], "a"),
        ]

        self.assertEqual(
            group.formatted(),
            "import a\n"
            + "from {} import (\n".format("b" * 80)
            + "    c,\n"
            + "    d,\n"
            + ")",
        )
Beispiel #5
0
    def test_formatted(self):
        group = BaseImportGroup()
        group.statements = [
            ImportStatement([], 'b' * 80, [ImportLeaf('c'),
                                           ImportLeaf('d')]),
            ImportStatement([], 'a')
        ]

        self.assertEqual(
            group.formatted(),
            'import a\n' +
            'from {} import (\n'.format('b' * 80) +
            '    c,\n' +
            '    d,\n' +
            ')'
        )
Beispiel #6
0
    def test_formatted_with_artifacts(self):
        artifacts = {'sep': '\r\n'}
        group = BaseImportGroup(file_artifacts=artifacts)
        group.statements = [
            ImportStatement(list(), 'b' * 80, [ImportLeaf('c'),
                                               ImportLeaf('d')],
                            file_artifacts=artifacts),
            ImportStatement([], 'a', file_artifacts=artifacts)
        ]

        self.assertEqual(
            group.formatted(),
            'import a\r\n' +
            'from {} import (\r\n'.format('b' * 80) +
            '    c,\r\n' +
            '    d,\r\n' +
            ')'
        )
Beispiel #7
0
    def test_formatted_with_artifacts(self):
        artifacts = {"sep": "\r\n"}
        group = BaseImportGroup(file_artifacts=artifacts)
        group.statements = [
            ImportStatement(
                list(),
                "b" * 80,
                [ImportLeaf("c"), ImportLeaf("d")],
                file_artifacts=artifacts,
            ),
            ImportStatement([], "a", file_artifacts=artifacts),
        ]

        self.assertEqual(
            group.formatted(),
            "import a\r\n" + "from {} import (\r\n".format("b" * 80) +
            "    c,\r\n" + "    d,\r\n" + ")",
        )
Beispiel #8
0
    def test_formatted_with_artifacts(self):
        artifacts = {"sep": "\r\n"}
        group = BaseImportGroup(file_artifacts=artifacts)
        group.statements = [
            ImportStatement(
                list(),
                "b" * 80,
                [ImportLeaf("c"), ImportLeaf("d")],
                file_artifacts=artifacts,
            ),
            ImportStatement([], "a", file_artifacts=artifacts),
        ]

        self.assertEqual(
            group.formatted(),
            "import a\r\n"
            + "from {} import (\r\n".format("b" * 80)
            + "    c,\r\n"
            + "    d,\r\n"
            + ")",
        )