mirror of https://github.com/tLDP/python-tldp
renaming examples.sources to example.sources
This commit is contained in:
parent
9df21df31a
commit
8ae6cf7d69
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue