Commit 62488d54a415fcc9afb59e4467a8f3b076ed971d
1 parent
aedcf659
Exists in
master
and in
1 other branch
Updates com tests.
Showing
4 changed files
with
14 additions
and
16 deletions
Show diff stats
src/tests/recommender_tests.py
| ... | ... | @@ -44,6 +44,9 @@ class RecommenderTests(unittest2.TestCase): |
| 44 | 44 | @classmethod |
| 45 | 45 | def setUpClass(self): |
| 46 | 46 | cfg = Config() |
| 47 | + cfg.popcon_index = "test_data/.sample_pxi" | |
| 48 | + cfg.popcon_dir = "test_data/popcon_dir" | |
| 49 | + cfg.clusters_dir = "test_data/clusters_dir" | |
| 47 | 50 | self.rec = Recommender(cfg) |
| 48 | 51 | |
| 49 | 52 | def test_set_strategy(self): | ... | ... |
src/tests/runner.py
| ... | ... | @@ -22,6 +22,7 @@ __license__ = """ |
| 22 | 22 | import unittest2 |
| 23 | 23 | from user_tests import UserTests, FilterTagTests, FilterDescriptionTests |
| 24 | 24 | from recommender_tests import RecommendationResultTests, RecommenderTests |
| 25 | +from data_tests import PopconSubmissionTests, PopconXapianIndexTests | |
| 25 | 26 | from strategy_tests import (PkgMatchDeciderTests, UserMatchDeciderTests, |
| 26 | 27 | PkgExpandDeciderTests, TagExpandDeciderTests, ContentBasedStrategyTests, |
| 27 | 28 | CollaborativeStrategyTests, DemographicStrategyTests, |
| ... | ... | @@ -37,6 +38,7 @@ def load_tests(test_cases): |
| 37 | 38 | |
| 38 | 39 | test_lists = [[UserTests, FilterTagTests, FilterDescriptionTests], |
| 39 | 40 | [RecommendationResultTests, RecommenderTests], |
| 41 | + [PopconSubmissionTests, PopconXapianIndexTests], | |
| 40 | 42 | [PkgMatchDeciderTests, UserMatchDeciderTests, |
| 41 | 43 | PkgExpandDeciderTests, TagExpandDeciderTests, |
| 42 | 44 | ContentBasedStrategyTests, CollaborativeStrategyTests, | ... | ... |
src/tests/strategy_tests.py
| ... | ... | @@ -26,8 +26,7 @@ sys.path.insert(0,'../') |
| 26 | 26 | from error import Error |
| 27 | 27 | from user import User |
| 28 | 28 | from recommender import RecommendationResult |
| 29 | -from config import * | |
| 30 | -#from data import * | |
| 29 | +from config import Config | |
| 31 | 30 | from strategy import (PkgMatchDecider, UserMatchDecider, PkgExpandDecider, |
| 32 | 31 | TagExpandDecider, ContentBasedStrategy, |
| 33 | 32 | CollaborativeStrategy, DemographicStrategy, |
| ... | ... | @@ -92,7 +91,6 @@ class TagExpandDeciderTests(unittest2.TestCase): |
| 92 | 91 | class ContentBasedStrategyTests(unittest2.TestCase): |
| 93 | 92 | @classmethod |
| 94 | 93 | def setUpClass(self): |
| 95 | - | |
| 96 | 94 | pass |
| 97 | 95 | |
| 98 | 96 | class CollaborativeStrategyTests(unittest2.TestCase): | ... | ... |
src/tests/user_tests.py
| ... | ... | @@ -47,11 +47,11 @@ class UserTests(unittest2.TestCase): |
| 47 | 47 | def setUpClass(self): |
| 48 | 48 | cfg = Config() |
| 49 | 49 | self.axi = xapian.Database(cfg.axi) |
| 50 | - sample_packages = ["gimp","aaphoto","eog","emacs","dia","ferret", | |
| 51 | - "festival","file","inkscape","xpdf"] | |
| 52 | - self.sample_axi = SampleAptXapianIndex(sample_packages,self.axi) | |
| 50 | + packages = ["gimp","aaphoto","eog","emacs","dia","ferret", | |
| 51 | + "festival","file","inkscape","xpdf"] | |
| 52 | + path = "test_data/.sample_axi" | |
| 53 | + self.sample_axi = SampleAptXapianIndex(packages,self.axi,path) | |
| 53 | 54 | self.user = User({"gimp":1,"aaphoto":1,"eog":1,"emacs":1}) |
| 54 | - #self.sample_axi._print() | |
| 55 | 55 | |
| 56 | 56 | def test_hash(self): |
| 57 | 57 | new_user = User(dict()) |
| ... | ... | @@ -125,17 +125,12 @@ class UserTests(unittest2.TestCase): |
| 125 | 125 | self.user.full_profile(self.sample_axi,10)) |
| 126 | 126 | |
| 127 | 127 | def test_tag_profile(self): |
| 128 | - self.assertEqual(self.user.tag_profile(self.sample_axi,10), | |
| 129 | - ['XTuse::editing', 'XTworks-with::image:raster', | |
| 130 | - 'XTworks-with-format::png', 'XTworks-with-format::jpg', | |
| 131 | - 'XTworks-with::image','XTimplemented-in::c', | |
| 132 | - 'XTsuite::gnome', 'XTsuite::emacs', | |
| 133 | - 'XTrole::metapackage', 'XTdevel::editor']) | |
| 128 | + self.assertEqual(self.user.tag_profile(self.sample_axi,2), | |
| 129 | + ['XTuse::editing', 'XTworks-with-format::jpg']) | |
| 134 | 130 | |
| 135 | 131 | def test_desc_profile(self): |
| 136 | - self.assertEqual(self.user.desc_profile(self.sample_axi,10), | |
| 137 | - ['image', 'the', 'which', 'manipulation', 'program', | |
| 138 | - 'input', 'a', 'gnu', 'images', 'this']) | |
| 132 | + self.assertEqual(self.user.desc_profile(self.sample_axi,2), | |
| 133 | + ['image', 'the']) | |
| 139 | 134 | |
| 140 | 135 | def test_full_profile(self): |
| 141 | 136 | self.assertEqual(self.user.full_profile(self.sample_axi,10), | ... | ... |