Ticket #6198: pythonpath-contains-6198.patch
| File pythonpath-contains-6198.patch, 1.4 KB (added by ephess, 6 months ago) |
|---|
-
twisted/python/modules.py
708 708 return module 709 709 raise KeyError(modname) 710 710 711 def __contains__(self, module): 712 """ 713 Check to see whether or not a module exists on my sysPath. 711 714 715 @param module: The module to look for on my sysPath 716 """ 717 try: 718 self.__getitem__(module) 719 return True 720 except KeyError: 721 return False 722 712 723 def __repr__(self): 713 724 """ 714 725 Display my sysPath and moduleDict in a string representation. -
twisted/test/test_modules.py
492 492 "(PEP 302 violation - check your local configuration).") 493 493 self.assertEqual(len(warnings), 1) 494 494 self.assertEqual(thisModule.name, __name__) 495 496 497 def test_containsModule(self): 498 """ 499 PythonPath should support the __contains__ API to check whether or not 500 a particular module is on this path. 501 """ 502 thePath = modules.PythonPath() 503 self.assertIn('os', thePath) 504 self.assertNotIn('bogusModule', thePath)
