Added documentation to the test cases
This commit is contained in:
parent
b9a8c65d24
commit
1557d17877
@ -1,8 +1,10 @@
|
||||
import copy
|
||||
import unittest
|
||||
from FourmiCrawler import pipelines, spider, items
|
||||
|
||||
from scrapy.exceptions import DropItem
|
||||
|
||||
from FourmiCrawler import pipelines, spider, items
|
||||
|
||||
|
||||
class TestPipelines(unittest.TestCase):
|
||||
|
||||
@ -10,6 +12,7 @@ class TestPipelines(unittest.TestCase):
|
||||
self.testItem = items.Result()
|
||||
|
||||
def test_NonePipeline(self):
|
||||
#Testing the pipeline that replaces the None values in items.
|
||||
self.testItem["value"] = "abc"
|
||||
pipe = pipelines.RemoveNonePipeline()
|
||||
processed = pipe.process_item(self.testItem, spider.FourmiSpider())
|
||||
@ -22,6 +25,7 @@ class TestPipelines(unittest.TestCase):
|
||||
self.assertIs(processed[key], "")
|
||||
|
||||
def test_DuplicatePipeline(self):
|
||||
#Testing the pipeline that removes duplicates.
|
||||
self.testItem["attribute"] = "test"
|
||||
self.testItem["value"] = "test"
|
||||
self.testItem["conditions"] = "test"
|
||||
@ -35,6 +39,7 @@ class TestPipelines(unittest.TestCase):
|
||||
self.assertEqual(pipe.process_item(otherItem, spider.FourmiSpider()), otherItem)
|
||||
|
||||
def test_AttributeSelection(self):
|
||||
#Testing the pipeline that selects attributes.
|
||||
item1 = copy.deepcopy(self.testItem)
|
||||
item2 = copy.deepcopy(self.testItem)
|
||||
|
||||
|
Reference in New Issue
Block a user