comparison test/db_test_base.py @ 8173:079958914ed7

doc/test: issue2551374 - add error handling for filter expressions Added doc that invalid filter expressions are silently ignored and a fallback search is generated. Added disabled test that uses incorrect filter expression examples from this issue.
author John Rouillard <rouilj@ieee.org>
date Mon, 02 Dec 2024 13:53:23 -0500
parents e9af08743759
children 741ea8a86012
comparison
equal deleted inserted replaced
8172:6a58acc3f39f 8173:079958914ed7
2071 ae(filt(None, {a: ['1','2','-3']}, ('+',a)), []) 2071 ae(filt(None, {a: ['1','2','-3']}, ('+',a)), [])
2072 ae(filt(None, {a: ['1','2','-4']}, ('+',a)), ['1','2']) 2072 ae(filt(None, {a: ['1','2','-4']}, ('+',a)), ['1','2'])
2073 ae(filt(None, {a: ['1','-2','2','-2','-3']}, ('+',a)), ['3','4']) 2073 ae(filt(None, {a: ['1','-2','2','-2','-3']}, ('+',a)), ['3','4'])
2074 ae(filt(None, {a: ['1','-2','2','-2','-4']}, ('+',a)), 2074 ae(filt(None, {a: ['1','-2','2','-2','-4']}, ('+',a)),
2075 ['3','4','1','2']) 2075 ['3','4','1','2'])
2076
2077 def NOtestFilteringLinkInvalid(self):
2078 """Test invalid filter expressions.
2079 Code must be written to generate an exception for these.
2080 Then this code must be changed to test the exception.
2081 See issue 2551374 in the roundup tracker.
2082 """
2083 ae, iiter = self.filteringSetup()
2084 a = 'assignedto'
2085 # filt(??, filter expression, sort order)
2086 # ae = self.assertEqual(val1, val2)
2087 for filt in iiter():
2088 # -2 is missing an operand
2089 ae(filt(None, {a: ['-2','2','-2','-4']},
2090 ('+',a)), [])
2091 # 3 is left on the stack
2092 ae(filt(None, {a: ['3','2','-2']},
2093 ('+',a)), [])
2094
2076 2095
2077 def testFilteringRevLink(self): 2096 def testFilteringRevLink(self):
2078 ae, iiter = self.filteringSetupTransitiveSearch('user') 2097 ae, iiter = self.filteringSetupTransitiveSearch('user')
2079 # We have 2098 # We have
2080 # issue assignedto 2099 # issue assignedto

Roundup Issue Tracker: http://roundup-tracker.org/