zopefoundation / zope.testbrowser

Programmable browser for functional black-box tests
Other
21 stars 16 forks source link

Add error checking to displayValue setters #89

Closed cjwatson closed 4 years ago

cjwatson commented 4 years ago

Add error checking to the setters for ListControl.displayValue and CheckboxListControl.displayValue: in line with the old mechanize-based implementation, these will now raise ItemNotFoundError if any of the given values are not found, or ItemCountError on trying to set more than one value on a single-valued control.

While this could technically be a backward-incompatibility in some cases, non-matching elements of the requested value were previously silently ignored, which seems overwhelmingly more likely to have resulted in hidden bugs.

I considered adding similar checks to the corresponding value setters, but as far as I can see mechanize didn't have such checks there, so the compatibility bar for changes is higher. Also, values are more likely to be stable than labels, and are often shorter identifiers that are somewhat less prone to typos.

Fixes #44.