Beispiel #1
0
    def test_two_extras_raises(self):
        old_content = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            [extras]
            a = b
            [extras]
            b = c

            [entry_points]
            console_scripts =
                foo = bar:quux
            """)
        with testtools.ExpectedException(parsley.ParseError):
            project._extras_compiled(old_content).ini()
Beispiel #2
0
    def test_none(self):
        old_content = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            [entry_points]
            console_scripts =
                foo = bar:quux
            """)
        ini = project._extras_compiled(old_content).ini()
        self.assertEqual(ini, (old_content, None, ''))
Beispiel #3
0
    def test_extras(self):
        # We get an AST for extras we can use to preserve comments.
        old_content = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            [extras]
            # comment1
            a =
             b
             c
            # comment2
            # comment3
            d =
             e
            # comment4

            [entry_points]
            console_scripts =
                foo = bar:quux
            """)
        prefix = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            """)
        suffix = textwrap.dedent(u"""\
            [entry_points]
            console_scripts =
                foo = bar:quux
            """)
        extras = [
            project._Comment('# comment1\n'),
            project._Extra('a', '\nb\nc\n'),
            project._Comment('# comment2\n'),
            project._Comment('# comment3\n'),
            project._Extra('d', '\ne\n'),
            project._Comment('# comment4\n')]
        ini = project._extras_compiled(old_content).ini()
        self.assertEqual(ini, (prefix, extras, suffix))
Beispiel #4
0
    def test_no_eol(self):
        old_content = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            [entry_points]
            console_scripts =
                foo = bar:quux""")
        expected1 = textwrap.dedent(u"""
            [metadata]
            # something something
            name = fred

            [entry_points]
            console_scripts =
            """)
        suffix = '    foo = bar:quux'
        ini = project._extras_compiled(old_content).ini()
        self.assertEqual(ini, (expected1, None, suffix))