Mercurial > p > roundup > code
comparison test/test_actions.py @ 3635:53987aa153d2
Transitive-property support.
- Fixed some of the pet-peeves from pep8
- Better parameter names for new _subselect method
- use new-style class for support.Proptree but needed a new-style class
for the property I introduced anyway.
- Fix a bug where searching did the wrong thing (interestingly enough
the same wrong thing for all backends): A search for
{'messages': ['1'], 'messages.author': ['2']}
would ignore the 'messages' part (messages being non-leaf node in
proptree). Fixed and added a regression test for this.
- Added the transitive searching to the SearchAction. New method
get_transitive_prop introduced in hyperdb that does the transitive
version of getprops()[name]. Fixed two tests to use the (faked) method
instead of getprop.
Now searching for transitive props via the web-interface works for me.
Thanks to alexander smishlajev for pointing me at the coding style.
Sorry for stepping on the peeves -- I'm using a different coding style
in most other projects I'm doing ...
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Thu, 13 Jul 2006 10:14:56 +0000 |
| parents | 7faae85e1e33 |
| children | 0dd05c9e5fff |
comparison
equal
deleted
inserted
replaced
| 3634:57c66056ffe4 | 3635:53987aa153d2 |
|---|---|
| 96 self.assertEqual(self.action.getQueryName(), 'foo') | 96 self.assertEqual(self.action.getQueryName(), 'foo') |
| 97 | 97 |
| 98 class FakeFilterVarsTestCase(SearchActionTestCase): | 98 class FakeFilterVarsTestCase(SearchActionTestCase): |
| 99 def setUp(self): | 99 def setUp(self): |
| 100 SearchActionTestCase.setUp(self) | 100 SearchActionTestCase.setUp(self) |
| 101 self.client.db.classes.getprops = lambda: {'foo': | 101 self.client.db.classes.get_transitive_prop = lambda x: \ |
| 102 hyperdb.Multilink('foo')} | 102 hyperdb.Multilink('foo') |
| 103 | 103 |
| 104 def assertFilterEquals(self, expected): | 104 def assertFilterEquals(self, expected): |
| 105 self.action.fakeFilterVars() | 105 self.action.fakeFilterVars() |
| 106 self.assertEqual(self.form.getvalue('@filter'), expected) | 106 self.assertEqual(self.form.getvalue('@filter'), expected) |
| 107 | 107 |
| 129 self.client.db.classes.getprops = lambda: {'foo': hyperdb.String()} | 129 self.client.db.classes.getprops = lambda: {'foo': hyperdb.String()} |
| 130 self.form.value.append(MiniFieldStorage('foo', 'hello')) | 130 self.form.value.append(MiniFieldStorage('foo', 'hello')) |
| 131 self.assertFilterEquals('foo') | 131 self.assertFilterEquals('foo') |
| 132 | 132 |
| 133 def testTokenizedStringKey(self): | 133 def testTokenizedStringKey(self): |
| 134 self.client.db.classes.getprops = lambda: {'foo': hyperdb.String()} | 134 self.client.db.classes.get_transitive_prop = lambda x: hyperdb.String() |
| 135 self.form.value.append(MiniFieldStorage('foo', 'hello world')) | 135 self.form.value.append(MiniFieldStorage('foo', 'hello world')) |
| 136 | 136 |
| 137 self.assertFilterEquals('foo') | 137 self.assertFilterEquals('foo') |
| 138 | 138 |
| 139 # The single value gets replaced with the tokenized list. | 139 # The single value gets replaced with the tokenized list. |
