Exemplo n.º 1
0
 def test_does_match_with_eq_string(self):
     f = FilterCondition('headline', 'eq', 'Story')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 2
0
 def test_does_match_with_nin_filter(self):
     f = FilterCondition('urgency', 'nin', '2,3,4')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
Exemplo n.º 3
0
 def test_does_match_with_eq(self):
     f = FilterCondition('urgency', 'eq', '1')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
 def test_does_match_with_eq(self):
     f = FilterCondition("urgency", "eq", "1")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 5
0
 def test_does_match_with_notlike_filter(self):
     f = FilterCondition('headline', 'notlike', 'Que')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertTrue(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
Exemplo n.º 6
0
 def test_does_match_with_eq(self):
     f = FilterCondition('urgency', 'eq', '1')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
 def test_does_match_with_nin_filter(self):
     f = FilterCondition("urgency", "nin", "2,3,4")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
Exemplo n.º 8
0
 def test_does_match_with_startswith_filter(self):
     f = FilterCondition('headline', 'startswith', 'Sto')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 9
0
 def test_does_match_with_like_partial(self):
     f = FilterCondition('headline', 'like', 'tor')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 10
0
 def test_does_match_with_notlike_filter(self):
     f = FilterCondition('headline', 'notlike', 'Que')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertTrue(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
 def test_does_match_with_endswith_filter(self):
     f = FilterCondition("headline", "endswith", "Que")
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
 def test_does_match_with_like_full(self):
     f = FilterCondition("headline", "like", "story")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 13
0
 def test_does_match_with_nin_filter(self):
     f = FilterCondition('urgency', 'nin', '2,3,4')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
 def test_does_match_with_eq_string(self):
     f = FilterCondition("headline", "eq", "Story")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 15
0
 def test_does_match_with_like_partial(self):
     f = FilterCondition('headline', 'like', 'tor')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 16
0
 def test_does_match_with_startswith_filter(self):
     f = FilterCondition('headline', 'startswith', 'Sto')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
Exemplo n.º 17
0
 def test_does_match_with_eq_string(self):
     f = FilterCondition('headline', 'eq', 'Story')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
 def test_does_match_with_in_filter_case_insensitive(self):
     f = FilterCondition("source", "in", "aap,reuters")
     self.assertTrue(f.does_match({"source": "AAP"}))
     self.assertTrue(f.does_match({"source": "aap"}))
     self.assertTrue(f.does_match({"source": "REUTERS"}))
     f = FilterCondition("source", "in", "AAP")
     self.assertTrue(f.does_match({"source": "AAP"}))
     self.assertTrue(f.does_match({"source": "aap"}))
     self.assertFalse(f.does_match({"source": "REUTERS"}))
Exemplo n.º 19
0
 def test_does_match_with_in_filter_case_insensitive(self):
     f = FilterCondition('source', 'in', 'aap,reuters')
     self.assertTrue(f.does_match({'source': 'AAP'}))
     self.assertTrue(f.does_match({'source': 'aap'}))
     self.assertTrue(f.does_match({'source': 'REUTERS'}))
     f = FilterCondition('source', 'in', 'AAP')
     self.assertTrue(f.does_match({'source': 'AAP'}))
     self.assertTrue(f.does_match({'source': 'aap'}))
     self.assertFalse(f.does_match({'source': 'REUTERS'}))
Exemplo n.º 20
0
 def test_does_match_with_in_filter_case_insensitive(self):
     f = FilterCondition('source', 'in', 'aap,reuters')
     self.assertTrue(f.does_match({'source': 'AAP'}))
     self.assertTrue(f.does_match({'source': 'aap'}))
     self.assertTrue(f.does_match({'source': 'REUTERS'}))
     f = FilterCondition('source', 'in', 'AAP')
     self.assertTrue(f.does_match({'source': 'AAP'}))
     self.assertTrue(f.does_match({'source': 'aap'}))
     self.assertFalse(f.does_match({'source': 'REUTERS'}))
Exemplo n.º 21
0
 def test_does_match_with_subject_filter(self):
     f = FilterCondition('subject', 'in', '05005003')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 22
0
 def test_does_match_with_ne_int(self):
     f = FilterCondition('priority', 'ne', '3')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertTrue(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
 def test_does_match_with_gte_int(self):
     f = FilterCondition("priority", "gte", "3")
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
Exemplo n.º 24
0
 def test_does_match_with_sms_filter(self):
     f = FilterCondition('sms', 'nin', 'true')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 25
0
 def test_does_match_with_ne_int(self):
     f = FilterCondition('priority', 'ne', '3')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertTrue(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 26
0
 def test_does_match_with_sms_filter(self):
     f = FilterCondition('sms', 'nin', 'true')
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 27
0
 def test_does_match_with_subject_filter(self):
     f = FilterCondition('subject', 'in', '05005003')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 28
0
 def test_does_match_with_embargo_filter_with_true(self):
     f = FilterCondition('embargo', 'eq', 'true')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
 def test_does_match_with_sms_filter(self):
     f = FilterCondition("sms", "nin", "true")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
 def test_does_match_with_embargo_filter_with_false(self):
     f = FilterCondition("embargo", "eq", "false")
     self.assertTrue(f.does_match(self.articles[0]))
     self.assertTrue(f.does_match(self.articles[1]))
     self.assertTrue(f.does_match(self.articles[2]))
     self.assertTrue(f.does_match(self.articles[3]))
     self.assertTrue(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertTrue(f.does_match(self.articles[7]))
Exemplo n.º 31
0
 def test_does_match_with_embargo_filter_with_true(self):
     f = FilterCondition('embargo', 'eq', 'true')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertTrue(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
Exemplo n.º 32
0
 def test_does_match_with_category_filter(self):
     f = FilterCondition('anpa_category', 'in', 'a,i')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
     self.assertTrue(f.does_match(self.articles[8]))
Exemplo n.º 33
0
 def test_does_match_with_category_filter(self):
     f = FilterCondition('anpa_category', 'in', 'a,i')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertFalse(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
     self.assertTrue(f.does_match(self.articles[8]))
Exemplo n.º 34
0
 def test_does_match_with_genre_filter(self):
     f = FilterCondition('genre', 'in', 'Sidebar')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
     self.assertFalse(f.does_match({'genre': None}))
     self.assertTrue(f.does_match({'genre': [{'name': 'Sidebar'}]}))
     self.assertFalse(f.does_match({'genre': [{'name': 'Article'}]}))
     self.assertTrue(f.does_match({'genre': [{'name': 'Sidebar'}, {'name': 'Article'}]}))
Exemplo n.º 35
0
 def test_does_match_with_genre_filter(self):
     f = FilterCondition("genre", "in", "Sidebar")
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
     self.assertFalse(f.does_match({"genre": None}))
     self.assertTrue(f.does_match({"genre": [{"name": "Sidebar"}]}))
     self.assertFalse(f.does_match({"genre": [{"name": "Article"}]}))
     self.assertTrue(f.does_match({"genre": [{"name": "Sidebar"}, {"name": "Article"}]}))
Exemplo n.º 36
0
 def test_does_match_with_genre_filter(self):
     f = FilterCondition('genre', 'in', 'Sidebar')
     self.assertFalse(f.does_match(self.articles[0]))
     self.assertFalse(f.does_match(self.articles[1]))
     self.assertFalse(f.does_match(self.articles[2]))
     self.assertFalse(f.does_match(self.articles[3]))
     self.assertFalse(f.does_match(self.articles[4]))
     self.assertFalse(f.does_match(self.articles[5]))
     self.assertTrue(f.does_match(self.articles[6]))
     self.assertFalse(f.does_match(self.articles[7]))
     self.assertFalse(f.does_match({'genre': None}))
     self.assertTrue(f.does_match({'genre': [{'name': 'Sidebar'}]}))
     self.assertFalse(f.does_match({'genre': [{'name': 'Article'}]}))
     self.assertTrue(f.does_match({'genre': [{'name': 'Sidebar'}, {'name': 'Article'}]}))
 def test_does_match_with_startswith_filter_html_field_with_fluff(self):
     f = FilterCondition("body_html", "startswith", "SDA")
     self.assertTrue(f.does_match(self.articles[11]))
Exemplo n.º 38
0
 def test_does_match_with_startswith_filter_html_field(self):
     f = FilterCondition('body_html', 'startswith', 'men')
     self.assertTrue(f.does_match(self.articles[9]))
Exemplo n.º 39
0
 def test_does_match_with_startswith_filter_html_field(self):
     f = FilterCondition('body_html', 'startswith', 'men')
     self.assertTrue(f.does_match(self.articles[9]))