[Checkins] SVN: gocept.selenium/trunk/ raise a better readable exception when an unimplemented selenese method is called
Thomas Lotze
tl at gocept.com
Thu Mar 11 05:55:30 EST 2010
Log message for revision 109908:
raise a better readable exception when an unimplemented selenese method is called
Changed:
U gocept.selenium/trunk/CHANGES.txt
U gocept.selenium/trunk/src/gocept/selenium/selenese.py
-=-
Modified: gocept.selenium/trunk/CHANGES.txt
===================================================================
--- gocept.selenium/trunk/CHANGES.txt 2010-03-11 10:54:01 UTC (rev 109907)
+++ gocept.selenium/trunk/CHANGES.txt 2010-03-11 10:55:29 UTC (rev 109908)
@@ -7,7 +7,10 @@
- API expansion: add `getLocation` to retrieve currently loaded URL in
browser.
+- Usability: raise a better readable exception when an unimplemented selenese
+ method is called.
+
0.3 (2010-01-12)
----------------
Modified: gocept.selenium/trunk/src/gocept/selenium/selenese.py
===================================================================
--- gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-11 10:54:01 UTC (rev 109907)
+++ gocept.selenium/trunk/src/gocept/selenium/selenese.py 2010-03-11 10:55:29 UTC (rev 109908)
@@ -248,6 +248,7 @@
# Internal
def __getattr__(self, name):
+ requested_name = name
if name.startswith('waitFor'):
name = name.replace('waitFor', 'assert', 1)
assertion = getattr(self, name)
@@ -270,6 +271,8 @@
if getter is None:
getter_name = name.replace('assert', 'is', 1)
getter = getattr(self, getter_name, None)
+ if getter is None:
+ raise AttributeError(requested_name)
if getter.assert_type == 'pattern':
return lambda pattern: self._assert_pattern(getter, pattern)
elif getter.assert_type == 'locator':
@@ -278,7 +281,7 @@
return lambda locator, pattern: \
self._assert_pattern(getter, pattern, locator)
- raise AttributeError(name)
+ raise AttributeError(requested_name)
def _assert(self, getter, *args, **kw):
if not getter(*args, **kw):
More information about the checkins
mailing list