diff --git a/tests/examples.py b/tests/example.py similarity index 100% rename from tests/examples.py rename to tests/example.py diff --git a/tests/test_sources.py b/tests/test_sources.py index 980bd65..9d5138c 100644 --- a/tests/test_sources.py +++ b/tests/test_sources.py @@ -17,7 +17,7 @@ except ImportError: from tldptesttools import * # -- Test Data -import examples +import example # -- SUT from tldp.sources import SourceCollection, SourceDocument @@ -28,7 +28,7 @@ datadir = os.path.join(os.path.dirname(__file__), 'testdata') class TestFileSourceCollectionMultiDir(TestToolsFilesystem): def test_multidir_finding_singlefiles(self): - ex = random.choice(examples.sources) + ex = random.choice(example.sources) doc0 = SimpleNamespace(reldir='LDP/howto', stem="A-Unique-Stem") doc1 = SimpleNamespace(reldir='LDP/guide', stem="A-Different-Stem") documents = (doc0, doc1) @@ -42,7 +42,7 @@ class TestFileSourceCollectionMultiDir(TestToolsFilesystem): self.assertEquals(expected, found) def test_multidir_finding_namecollision(self): - ex = random.choice(examples.sources) + ex = random.choice(example.sources) doc0 = SimpleNamespace(reldir='LDP/howto', stem="A-Non-Unique-Stem") doc1 = SimpleNamespace(reldir='LDP/guide', stem="A-Non-Unique-Stem") documents = (doc0, doc1) @@ -66,7 +66,7 @@ class TestFileSourceCollectionOneDir(TestToolsFilesystem): self.assertEquals(0, len(s)) def test_finding_singlefile(self): - ex = random.choice(examples.sources) + ex = random.choice(example.sources) maindir = 'LDP/LDP/howto' reldir, absdir = self.adddir(maindir) _, _ = self.addfile(absdir, ex) @@ -74,7 +74,7 @@ class TestFileSourceCollectionOneDir(TestToolsFilesystem): self.assertEquals(1, len(s)) def test_skipping_misnamed_singlefile(self): - ex = random.choice(examples.sources) + ex = random.choice(example.sources) maindir = 'LDP/LDP/howto' reldir, absdir = self.adddir(maindir) self.addfile(absdir, ex, ext=".mis") @@ -82,7 +82,7 @@ class TestFileSourceCollectionOneDir(TestToolsFilesystem): self.assertEquals(1, len(s)) def test_multiple_stems_of_different_extensions(self): - ex = random.choice(examples.sources) + ex = random.choice(example.sources) stem = 'A-Non-Unique-Stem' maindir = os.path.join('LDP/LDP/howto', stem) reldir, absdir = self.adddir(maindir) diff --git a/tests/test_typeguesser.py b/tests/test_typeguesser.py index a7d589c..23bf173 100644 --- a/tests/test_typeguesser.py +++ b/tests/test_typeguesser.py @@ -6,7 +6,7 @@ import unittest from tempfile import NamedTemporaryFile as ntf # -- Test Data -import examples +import example # -- SUT from tldp.typeguesser import guess @@ -26,13 +26,13 @@ def genericGuessTest(content, ext): class TestDoctypes(unittest.TestCase): def testDetectionBySignature(self): - for ex in examples.sources: + for ex in example.sources: if isinstance(ex.type, SignatureChecker): dt = genericGuessTest(ex.content, ex['ext']) self.assertEqual(ex.type, dt) def testDetectionByExtension(self): - for ex in examples.sources: + for ex in example.sources: if not isinstance(ex.type, SignatureChecker): dt = genericGuessTest(ex.content, ex.ext) self.assertEqual(ex.type, dt) @@ -53,12 +53,12 @@ class TestDoctypes(unittest.TestCase): self.assertIsNone(dt) def testGuessTooManyMatches(self): - a = examples.ex_docbook4xml.content - b = examples.ex_docbook5xml.content - four, fourdt = a + b, examples.ex_docbook4xml.type + a = example.ex_docbook4xml.content + b = example.ex_docbook5xml.content + four, fourdt = a + b, example.ex_docbook4xml.type dt = genericGuessTest(four, '.xml') self.assertIs(dt, fourdt) - five, fivedt = b + a, examples.ex_docbook5xml.type + five, fivedt = b + a, example.ex_docbook5xml.type dt = genericGuessTest(five, '.xml') self.assertIs(dt, fivedt)