8b0cf1875b8d696106598a67665f42b4f0d30479,tests/unit/test_modulegraph/test_modulegraph.py,TestFunctions,TestFunctions_2,#,288

Before Change


            self.assertEqual(info[1], "rb")
            self.assertEqual(info[2], imp.C_EXTENSION)

    if sys.version_info[:2] > (2,5):
        exec(textwrap.dedent("""\
            def test_deprecated(self):
                saved_add = modulegraph.addPackagePath
                saved_replace = modulegraph.replacePackage
                try:
                    called = []

                    def log_add(*args, **kwds):
                        called.append(("add", args, kwds))
                    def log_replace(*args, **kwds):
                        called.append(("replace", args, kwds))

                    modulegraph.addPackagePath = log_add
                    modulegraph.replacePackage = log_replace

                    with warnings.catch_warnings(record=True) as w:
                        warnings.simplefilter("always")
                        modulegraph.ReplacePackage("a", "b")
                        modulegraph.AddPackagePath("c", "d")

                    self.assertEqual(len(w), 2)
                    self.assertTrue(w[-1].category is DeprecationWarning)
                    self.assertTrue(w[-2].category is DeprecationWarning)

                    self.assertEqual(called, [
                        ("replace", ("a", "b"), {}),
                        ("add", ("c", "d"), {}),
                    ])

                finally:
                    modulegraph.addPackagePath = saved_add
                    modulegraph.replacePackage = saved_replace
            """), locals(), globals())

    def test_addPackage(self):
        saved = modulegraph._packagePathMap
        self.assertIsInstance(saved, dict)
        try:

After Change


            self.assertEqual(info[1], "rb")
            self.assertEqual(info[2], imp.C_EXTENSION)

    if sys.version_info[:2] > (2,5):
            def test_deprecated(self):
                saved_add = modulegraph.addPackagePath
                saved_replace = modulegraph.replacePackage
                try:
                    called = []

                    def log_add(*args, **kwds):
                        called.append(("add", args, kwds))
                    def log_replace(*args, **kwds):
                        called.append(("replace", args, kwds))

                    modulegraph.addPackagePath = log_add
                    modulegraph.replacePackage = log_replace

                    with warnings.catch_warnings(record=True) as w:
                        warnings.simplefilter("always")
                        modulegraph.ReplacePackage("a", "b")
                        modulegraph.AddPackagePath("c", "d")

                    self.assertEqual(len(w), 2)
                    self.assertTrue(w[-1].category is DeprecationWarning)
                    self.assertTrue(w[-2].category is DeprecationWarning)

                    self.assertEqual(called, [
                        ("replace", ("a", "b"), {}),
                        ("add", ("c", "d"), {}),
                    ])

                finally:
                    modulegraph.addPackagePath = saved_add
                    modulegraph.replacePackage = saved_replace

    def test_addPackage(self):
        saved = modulegraph._packagePathMap
        self.assertIsInstance(saved, dict)
        try:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pyinstaller/pyinstaller
Commit Name: 8b0cf1875b8d696106598a67665f42b4f0d30479
Time: 2017-02-13
Author: h.goebel@crazy-compilers.com
File Name: tests/unit/test_modulegraph/test_modulegraph.py
Class Name: TestFunctions
Method Name: TestFunctions_2


Project Name: pantsbuild/pants
Commit Name: 32479c73b83a9a875a28d1adce327573b39af37e
Time: 2014-04-30
Author: benjy@foursquare.com
File Name: src/python/pants/commands/goal.py
Class Name: Goal
Method Name: setup_parser


Project Name: pantsbuild/pants
Commit Name: e7b9ce76c065eb9ba46791fbef67a4961150dd2c
Time: 2015-05-18
Author: john.sirois@gmail.com
File Name: tests/python/pants_test/java/distribution/test_distribution.py
Class Name: MockDistributionTest
Method Name: exe