Archived
1
0

Added tests for the source loader

This commit is contained in:
Jip J. Dekker 2014-06-04 12:43:33 +02:00
parent 7a8c0fe6ad
commit c3d2bf92e5

View File

@ -1,5 +1,34 @@
import unittest
from sourceloader import SourceLoader
class TestSourceloader(unittest.TestCase):
pass
def setUp(self):
self.loader = SourceLoader()
def test_init(self):
# Test if sourceloader points to the right directory, where the sources are present.
self.assertIn("Source: Source", str(self.loader))
self.assertIn("Source: NIST", str(self.loader))
self.assertIn("Source: ChemSpider", str(self.loader))
self.assertIn("Source: WikipediaParser", str(self.loader))
def test_include(self):
#Tests for the include functionality.
self.loader.include(["So.rc.*"])
self.assertIn("Source: Source", str(self.loader))
self.assertNotIn("Source: NIST", str(self.loader))
self.assertNotIn("Source: ChemSpider", str(self.loader))
self.assertNotIn("Source: WikipediaParser", str(self.loader))
def test_exclude(self):
#Tests for the exclude functionality.
self.loader.exclude(["So.rc.*"])
self.assertNotIn("Source: Source", str(self.loader))
self.assertIn("Source: NIST", str(self.loader))
self.assertIn("Source: ChemSpider", str(self.loader))
self.assertIn("Source: WikipediaParser", str(self.loader))