summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/source/test_file_loader.py
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2014-01-04 22:06:49 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2014-01-04 22:06:49 (GMT)
commitd749c7ae683a98bb2f0c1ac3c9ac2d3c5bb6e51f (patch)
treedb62a95d76cc066f937039914a9c2461087b32cf /Lib/test/test_importlib/source/test_file_loader.py
parent78194cd4e920550bad4f9cad5f7411927ab3f458 (diff)
downloadcpython-d749c7ae683a98bb2f0c1ac3c9ac2d3c5bb6e51f.zip
cpython-d749c7ae683a98bb2f0c1ac3c9ac2d3c5bb6e51f.tar.gz
cpython-d749c7ae683a98bb2f0c1ac3c9ac2d3c5bb6e51f.tar.bz2
Issue #19927: Add __eq__ to path-based loaders in importlib.
Diffstat (limited to 'Lib/test/test_importlib/source/test_file_loader.py')
-rw-r--r--Lib/test/test_importlib/source/test_file_loader.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index 97cbf06..16e4df2 100644
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -27,6 +27,11 @@ class SimpleTest(abc.LoaderTests):
"""
+ def setUp(self):
+ self.name = 'spam'
+ self.filepath = os.path.join('ham', self.name + '.py')
+ self.loader = self.machinery.SourceFileLoader(self.name, self.filepath)
+
def test_load_module_API(self):
class Tester(self.abc.FileLoader):
def get_source(self, _): return 'attr = 42'
@@ -53,6 +58,14 @@ class SimpleTest(abc.LoaderTests):
with self.assertRaises(ImportError):
loader.get_filename(name + 'XXX')
+ def test_equality(self):
+ other = self.machinery.SourceFileLoader(self.name, self.filepath)
+ self.assertEqual(self.loader, other)
+
+ def test_inequality(self):
+ other = self.machinery.SourceFileLoader('_' + self.name, self.filepath)
+ self.assertNotEqual(self.loader, other)
+
# [basic]
def test_module(self):
with source_util.create_modules('_temp') as mapping: