summaryrefslogtreecommitdiffstats
path: root/Lib/packaging/tests/test_mixin2to3.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/packaging/tests/test_mixin2to3.py')
-rw-r--r--Lib/packaging/tests/test_mixin2to3.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/Lib/packaging/tests/test_mixin2to3.py b/Lib/packaging/tests/test_mixin2to3.py
deleted file mode 100644
index 08a102b..0000000
--- a/Lib/packaging/tests/test_mixin2to3.py
+++ /dev/null
@@ -1,87 +0,0 @@
-import textwrap
-
-from packaging.tests import unittest, support
-from packaging.compat import Mixin2to3
-
-
-class Mixin2to3TestCase(support.TempdirManager,
- support.LoggingCatcher,
- unittest.TestCase):
-
- def setUp(self):
- super(Mixin2to3TestCase, self).setUp()
- self.filename = self.mktempfile().name
-
- def check(self, source, wanted, **kwargs):
- source = textwrap.dedent(source)
- with open(self.filename, 'w') as fp:
- fp.write(source)
-
- Mixin2to3()._run_2to3(**kwargs)
-
- wanted = textwrap.dedent(wanted)
- with open(self.filename) as fp:
- converted = fp.read()
- self.assertMultiLineEqual(converted, wanted)
-
- def test_conversion(self):
- # check that code and doctests get converted
- self.check('''\
- """Example docstring.
-
- >>> print test
- test
-
- It works.
- """
- print 'test'
- ''',
- '''\
- """Example docstring.
-
- >>> print(test)
- test
-
- It works.
- """
- print('test')
-
- ''', # 2to3 adds a newline here
- files=[self.filename])
-
- def test_doctests_conversion(self):
- # check that doctest files are converted
- self.check('''\
- Welcome to the doc.
-
- >>> print test
- test
- ''',
- '''\
- Welcome to the doc.
-
- >>> print(test)
- test
-
- ''',
- doctests=[self.filename])
-
- def test_additional_fixers(self):
- # make sure the fixers argument works
- self.check("""\
- echo('42')
- echo2('oh no')
- """,
- """\
- print('42')
- print('oh no')
- """,
- files=[self.filename],
- fixers=['packaging.tests.fixer'])
-
-
-def test_suite():
- return unittest.makeSuite(Mixin2to3TestCase)
-
-if __name__ == "__main__":
- unittest.main(defaultTest="test_suite")