def test_is_py2_stdlib_module(self):
        """
        Tests whether the internal is_py2_stdlib_module function (called by the
        sys.modules scrubbing functions) is reliable.
        """
        externalmodules = [standard_library, utils]
        self.assertTrue(not any([
            standard_library.is_py2_stdlib_module(module)
            for module in externalmodules
        ]))

        py2modules = [sys, tempfile, copy, textwrap]
        if utils.PY2:
            # Debugging:
            for module in py2modules:
                if hasattr(module, '__file__'):
                    print(module.__file__, file=sys.stderr)
            self.assertTrue(
                all([
                    standard_library.is_py2_stdlib_module(module)
                    for module in py2modules
                ]))
        else:
            self.assertTrue(not any([
                standard_library.is_py2_stdlib_module(module)
                for module in py2modules
            ]))
 def test_is_py2_stdlib_module(self):
     """
     Tests whether the internal is_py2_stdlib_module function (called by the
     sys.modules scrubbing functions) is reliable.
     """
     py2modules = [sys, tempfile, os, copy, textwrap]
     externalmodules = [standard_library, utils]
     self.assertTrue(all([standard_library.is_py2_stdlib_module(module)
                          for module in py2modules]))
     self.assertTrue(not any([standard_library.is_py2_stdlib_module(module)
                          for module in externalmodules]))
    def test_is_py2_stdlib_module(self):
        """
        Tests whether the internal is_py2_stdlib_module function (called by the
        sys.modules scrubbing functions) is reliable.
        """
        externalmodules = [standard_library, utils]
        self.assertTrue(not any([standard_library.is_py2_stdlib_module(module)
                             for module in externalmodules]))

        py2modules = [sys, tempfile, copy, textwrap]
        if utils.PY2:
            # Debugging:
            for module in py2modules:
                if hasattr(module, '__file__'):
                    print(module.__file__, file=sys.stderr)
            self.assertTrue(all([standard_library.is_py2_stdlib_module(module)
                                 for module in py2modules]))
        else:
            self.assertTrue(
                    not any ([standard_library.is_py2_stdlib_module(module)
                              for module in py2modules]))