(self)
| 613 | """Test importlib.abc.SourceLoader for source-only loading.""" |
| 614 | |
| 615 | def test_get_source(self): |
| 616 | # Verify the source code is returned as a string. |
| 617 | # If an OSError is raised by get_data then raise ImportError. |
| 618 | expected_source = self.loader.source.decode('utf-8') |
| 619 | self.assertEqual(self.loader.get_source(self.name), expected_source) |
| 620 | def raise_OSError(path): |
| 621 | raise OSError |
| 622 | self.loader.get_data = raise_OSError |
| 623 | with self.assertRaises(ImportError) as cm: |
| 624 | self.loader.get_source(self.name) |
| 625 | self.assertEqual(cm.exception.name, self.name) |
| 626 | |
| 627 | def test_is_package(self): |
| 628 | # Properly detect when loading a package. |
nothing calls this directly
no test coverage detected