Commit e77dc1ed45ffb8db3219eb6a11432a2f8c1df6e2
1 parent
8503780d
Exists in
master
and in
1 other branch
New tests for FilterTag and FilterDescription classes.
Showing
2 changed files
with
16 additions
and
1 deletions
Show diff stats
src/tests/user_tests.py
... | ... | @@ -32,6 +32,21 @@ from data import * |
32 | 32 | def suite(): |
33 | 33 | return unittest2.TestLoader().loadTestsFromTestCase(UserTests) |
34 | 34 | |
35 | +class FilterTagTests(unittest2.TestCase): | |
36 | + def test_call_true(self): | |
37 | + self.assertTrue(FilterTag()("XTrole::program")) | |
38 | + | |
39 | + def test_call_false(self): | |
40 | + self.assertFalse(FilterTag()("role::program")) | |
41 | + | |
42 | +class FilterDescriptionTests(unittest2.TestCase): | |
43 | + def test_call_true(self): | |
44 | + self.assertTrue(FilterDescription()("program")) | |
45 | + #self.assertTrue(FilterDescription()("Zprogram")) | |
46 | + | |
47 | + def test_call_false(self): | |
48 | + self.assertFalse(FilterDescription()("XTprogram")) | |
49 | + | |
35 | 50 | class UserTests(unittest2.TestCase): |
36 | 51 | @classmethod |
37 | 52 | def setUpClass(self): | ... | ... |
src/user.py
... | ... | @@ -45,7 +45,7 @@ class FilterDescription(xapian.ExpandDecider): |
45 | 45 | """ |
46 | 46 | Return true if the term is a tag, else false. |
47 | 47 | """ |
48 | - return (term.islower()) | |
48 | + return term.islower() #or term.startswith("Z") | |
49 | 49 | |
50 | 50 | class DemographicProfile(Singleton): |
51 | 51 | def __init__(self): | ... | ... |