def test_extracting_path_to_compiled_python_file(self): self.assertEqual('path_to_file.py', _extract_source_path('path_to_file.py')) self.assertEqual('path_to_file.py', _extract_source_path('path_to_file.pyc')) self.assertEqual('path_to_file.py', _extract_source_path('path_to_file$py.class')) self.assertEqual('/path_to_file.py', _extract_source_path('file:/path_to_file.py')) self.assertEqual('/path_to_file.py', _extract_source_path('file:/path_to_file.pyc')) self.assertEqual('/path_to_file.py', _extract_source_path('file:/path_to_file$py.class'))
def test_extracting_path_to_jar(self): self.assertEqual('path_to_file.jar', _extract_source_path('path_to_file.jar')) self.assertEqual('/path_to_file.jar', _extract_source_path('file:/path_to_file.jar')) self.assertEqual('/path_to_file.jar', _extract_source_path('jar:file:/path_to_file.jar')) self.assertEqual( '/path_to_file.jar', _extract_source_path( 'jar:file:/path_to_file.jar!/JavaClass.class')) self.assertEqual( '/path_to_file.jar', _extract_source_path('file:/path_to_file.jar/PyModule.py')) self.assertEqual( '/path_to_file.jar', _extract_source_path('file:/path_to_file.jar\\PyModule.py'))