A web scraper build to search specific information for a given compound (and its pseudonyms)

Added tests for the source loader

+30 -1
+30 -1
tests/test_sourceloader.py
··· 1 1 import unittest 2 + from sourceloader import SourceLoader 3 + 2 4 3 5 4 6 class TestSourceloader(unittest.TestCase): 5 - pass 7 + 8 + def setUp(self): 9 + self.loader = SourceLoader() 10 + 11 + def test_init(self): 12 + # Test if sourceloader points to the right directory, where the sources are present. 13 + self.assertIn("Source: Source", str(self.loader)) 14 + self.assertIn("Source: NIST", str(self.loader)) 15 + self.assertIn("Source: ChemSpider", str(self.loader)) 16 + self.assertIn("Source: WikipediaParser", str(self.loader)) 17 + 18 + def test_include(self): 19 + #Tests for the include functionality. 20 + self.loader.include(["So.rc.*"]) 21 + 22 + self.assertIn("Source: Source", str(self.loader)) 23 + self.assertNotIn("Source: NIST", str(self.loader)) 24 + self.assertNotIn("Source: ChemSpider", str(self.loader)) 25 + self.assertNotIn("Source: WikipediaParser", str(self.loader)) 26 + 27 + def test_exclude(self): 28 + #Tests for the exclude functionality. 29 + self.loader.exclude(["So.rc.*"]) 30 + 31 + self.assertNotIn("Source: Source", str(self.loader)) 32 + self.assertIn("Source: NIST", str(self.loader)) 33 + self.assertIn("Source: ChemSpider", str(self.loader)) 34 + self.assertIn("Source: WikipediaParser", str(self.loader))