Skip to content

Commit

Permalink
abc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
warsaw committed Jul 31, 2012
1 parent 7d73171 commit 83c8fdc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Lib/test/test_importlib/source/test_abc_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def get_data(self, path):
def get_filename(self, fullname):
return self.path

def module_repr(self, module):
return '<module>'


class SourceLoaderMock(SourceOnlyLoaderMock):

Expand Down Expand Up @@ -107,6 +110,9 @@ def get_filename(self, name):
assert issubclass(w[0].category, DeprecationWarning)
return path

def module_repr(self):
return '<module>'


class PyLoaderCompatMock(PyLoaderMock):

Expand Down Expand Up @@ -779,11 +785,16 @@ class AbstractMethodImplTests(unittest.TestCase):
class Loader(abc.Loader):
def load_module(self, fullname):
super().load_module(fullname)
def module_repr(self, module):
super().module_repr(module)

class Finder(abc.Finder):
def find_module(self, _):
super().find_module(_)

def find_loader(self, _):
super().find_loader(_)

class ResourceLoader(Loader, abc.ResourceLoader):
def get_data(self, _):
super().get_data(_)
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_importlib/source/test_file_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def test_load_module_API(self):
# If fullname is not specified that assume self.name is desired.
class TesterMixin(importlib.abc.Loader):
def load_module(self, fullname): return fullname
def module_repr(self, module): return '<module>'

class Tester(importlib.abc.FileLoader, TesterMixin):
def get_code(self, _): pass
Expand All @@ -49,6 +50,7 @@ class Tester(importlib.abc.FileLoader):
def get_code(self, _): pass
def get_source(self, _): pass
def is_package(self, _): pass
def module_repr(self, _): pass

path = 'some_path'
name = 'some_name'
Expand Down

0 comments on commit 83c8fdc

Please sign in to comment.