[Python-checkins] r65018 - in sandbox/trunk/2to3: example.py lib2to3/fixes/fix_urllib.py lib2to3/tests/test_fixers.py

Collin Winter collinw at gmail.com
Wed Jul 16 19:12:57 CEST 2008


On Wed, Jul 16, 2008 at 9:55 AM, benjamin.peterson
<python-checkins at python.org> wrote:
> Author: benjamin.peterson
> Date: Wed Jul 16 18:55:21 2008
> New Revision: 65018
>
> Log:
> normalize whitespace
>
> Modified:
>   sandbox/trunk/2to3/example.py
>   sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py
>   sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
>
> Modified: sandbox/trunk/2to3/example.py
> ==============================================================================
> --- sandbox/trunk/2to3/example.py       (original)
> +++ sandbox/trunk/2to3/example.py       Wed Jul 16 18:55:21 2008
> @@ -1,5 +1,5 @@
>  #!/usr/bin/python
> -       # comment indented by tab
> +        # comment indented by tab
>
>  """Docstring.
>
> @@ -73,7 +73,7 @@
>     if not a.has_key(b) ** 2: pass
>
>  def foo():
> -       pass # body indented by tab
> +    pass # body indented by tab
>
>  def test_ws_comma():
>     yield 1,2 ,3

Why did you change these two? It's very clearly marked that they should be tabs.

Collin

> Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py
> ==============================================================================
> --- sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py      (original)
> +++ sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py      Wed Jul 16 18:55:21 2008
> @@ -173,4 +173,3 @@
>             self.cannot_convert(node, 'Cannot handle star imports.')
>         elif results.get('module_as'):
>             self.cannot_convert(node, 'This module is now multiple modules')
> -
>
> Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
> ==============================================================================
> --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py     (original)
> +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py     Wed Jul 16 18:55:21 2008
> @@ -1514,74 +1514,74 @@
>
>
>  class Test_urllib(FixerTestCase):
> -   fixer = "urllib"
> -   from ..fixes.fix_urllib import MAPPING as modules
> +    fixer = "urllib"
> +    from ..fixes.fix_urllib import MAPPING as modules
>
> -   def test_import_module(self):
> -       for old, changes in self.modules.items():
> -           b = "import %s" % old
> -           a = "import %s" % ", ".join(map(itemgetter(0), changes))
> -           self.check(b, a)
> -
> -   def test_import_from(self):
> -       for old, changes in self.modules.items():
> -           all_members = []
> -           for new, members in changes:
> -               for member in members:
> -                   all_members.append(member)
> -                   b = "from %s import %s" % (old, member)
> -                   a = "from %s import %s" % (new, member)
> -                   self.check(b, a)
> -
> -                   s = "from foo import %s" % member
> -                   self.unchanged(s)
> -
> -               b = "from %s import %s" % (old, ", ".join(members))
> -               a = "from %s import %s" % (new, ", ".join(members))
> -               self.check(b, a)
> -
> -               s = "from foo import %s" % ", ".join(members)
> -               self.unchanged(s)
> -
> -           # test the breaking of a module into multiple replacements
> -           b = "from %s import %s" % (old, ", ".join(all_members))
> -           a = "\n".join(["from %s import %s" % (new, ", ".join(members))
> -                           for (new, members) in changes])
> -           self.check(b, a)
> -
> -   def test_import_module_as(self):
> -       for old in self.modules:
> -           s = "import %s as foo" % old
> -           self.warns_unchanged(s, "This module is now multiple modules")
> -
> -   def test_import_from_as(self):
> -       for old, changes in self.modules.items():
> -           for new, members in changes:
> -               for member in members:
> -                   b = "from %s import %s as foo_bar" % (old, member)
> -                   a = "from %s import %s as foo_bar" % (new, member)
> -                   self.check(b, a)
> -
> -   def test_star(self):
> -       for old in self.modules:
> -           s = "from %s import *" % old
> -           self.warns_unchanged(s, "Cannot handle star imports")
> -
> -   def test_import_module_usage(self):
> -       for old, changes in self.modules.items():
> -           for new, members in changes:
> -               for member in members:
> -                   b = """
> -                       import %s
> -                       foo(%s.%s)
> -                       """ % (old, old, member)
> -                   a = """
> -                       import %s
> -                       foo(%s.%s)
> -                       """ % (", ".join([n for (n, mems)
> -                                          in self.modules[old]]),
> -                                        new, member)
> -                   self.check(b, a)
> +    def test_import_module(self):
> +        for old, changes in self.modules.items():
> +            b = "import %s" % old
> +            a = "import %s" % ", ".join(map(itemgetter(0), changes))
> +            self.check(b, a)
> +
> +    def test_import_from(self):
> +        for old, changes in self.modules.items():
> +            all_members = []
> +            for new, members in changes:
> +                for member in members:
> +                    all_members.append(member)
> +                    b = "from %s import %s" % (old, member)
> +                    a = "from %s import %s" % (new, member)
> +                    self.check(b, a)
> +
> +                    s = "from foo import %s" % member
> +                    self.unchanged(s)
> +
> +                b = "from %s import %s" % (old, ", ".join(members))
> +                a = "from %s import %s" % (new, ", ".join(members))
> +                self.check(b, a)
> +
> +                s = "from foo import %s" % ", ".join(members)
> +                self.unchanged(s)
> +
> +            # test the breaking of a module into multiple replacements
> +            b = "from %s import %s" % (old, ", ".join(all_members))
> +            a = "\n".join(["from %s import %s" % (new, ", ".join(members))
> +                            for (new, members) in changes])
> +            self.check(b, a)
> +
> +    def test_import_module_as(self):
> +        for old in self.modules:
> +            s = "import %s as foo" % old
> +            self.warns_unchanged(s, "This module is now multiple modules")
> +
> +    def test_import_from_as(self):
> +        for old, changes in self.modules.items():
> +            for new, members in changes:
> +                for member in members:
> +                    b = "from %s import %s as foo_bar" % (old, member)
> +                    a = "from %s import %s as foo_bar" % (new, member)
> +                    self.check(b, a)
> +
> +    def test_star(self):
> +        for old in self.modules:
> +            s = "from %s import *" % old
> +            self.warns_unchanged(s, "Cannot handle star imports")
> +
> +    def test_import_module_usage(self):
> +        for old, changes in self.modules.items():
> +            for new, members in changes:
> +                for member in members:
> +                    b = """
> +                        import %s
> +                        foo(%s.%s)
> +                        """ % (old, old, member)
> +                    a = """
> +                        import %s
> +                        foo(%s.%s)
> +                        """ % (", ".join([n for (n, mems)
> +                                           in self.modules[old]]),
> +                                         new, member)
> +                    self.check(b, a)
>
>
>  class Test_input(FixerTestCase):
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list