2 # vi: set softtabstop=4 shiftwidth=4 tabstop=8 expandtab:
9 class TestErrorRegex(unittest
.TestCase
):
11 def testBadFromAddress(self
):
15 <table cellpadding="0" cellspacing="0" summary="Warning message" class="warning" width="85%">
17 <td><img src="tripPlanning/images/imgWarning.gif"></td>
18 <td>The address you specified was not found. Please enter another.</td>
21 match
= Planner
._error
_rx
.search(text
)
22 self
.assertNotEquals(match
, None)
23 self
.assertEquals(match
.group("msg"),
24 ("The address you specified was not found. "
25 "Please enter another."))
27 # I don't know if it ever spits out multi-line errors, but might as well
29 def testMultiLineWarning(self
):
33 <table class="warning" width="85%">
35 <td>The address you specified was not found.""" "\n" \
36 """Please enter another.</td>
40 match
= Planner
._error
_rx
.search(text
)
41 self
.assertNotEquals(match
, None)
42 self
.assertEquals(match
.group("msg"),
43 ("The address you specified was not found.\n"
44 "Please enter another."))
46 # This one has a lot of whitespace that we should cut.
47 def testNoItinerariesError(self
):
49 <table cellpadding="0" cellspacing="0" summary="Warning message" class="warning" width="85%">
51 <td><img src="tripPlanning/images/imgWarning.gif"></td>
56 No itineraries could be found.
62 match
= Planner
._error
_rx
.search(text
)
63 self
.assertNotEquals(match
, None)
64 self
.assertEquals(match
.group("msg"), "No itineraries could be found.")
67 if __name__
== '__main__':