diff options
-rw-r--r-- | docs/news.txt | 3 | ||||
-rw-r--r-- | paste/fixture.py | 11 |
2 files changed, 10 insertions, 4 deletions
diff --git a/docs/news.txt b/docs/news.txt index ab69d85..a66b37c 100644 --- a/docs/news.txt +++ b/docs/news.txt @@ -12,6 +12,9 @@ svn trunk * Added a ``current`` method (an alias of ``current_conf``) to ``paste.config.DispatchingConfig``. +* Make test response ``.form`` attribute work when you have a single + named form. + 1.4 --- diff --git a/paste/fixture.py b/paste/fixture.py index e43d59d..9e2e1cb 100644 --- a/paste/fixture.py +++ b/paste/fixture.py @@ -505,10 +505,13 @@ class TestResponse(object): def form__get(self): forms = self.forms - assert len(forms) > 0, ( - "You used response.form, but no forms exist") - assert len(forms) == 1, ( - "You used response.form, but more than one form exists") + if not forms: + raise TypeError( + "You used response.form, but no forms exist") + if 1 in forms: + # There is more than one form + raise TypeError( + "You used response.form, but more than one form exists") return forms[0] form = property(form__get, |