2 # vi: set softtabstop=4 shiftwidth=4 tabstop=8 expandtab:
8 class TestErrorRegex(unittest
.TestCase
):
10 def testBadFromAddress(self
):
14 <table cellpadding="0" cellspacing="0" summary="Warning message" class="warning" width="85%">
16 <td><img src="tripPlanning/images/imgWarning.gif"></td>
17 <td>The address you specified was not found. Please enter another.</td>
20 match
= Planner
._error
_rx
.search(text
)
21 self
.assertNotEquals(match
, None)
22 self
.assertEquals(match
.group("msg"),
23 ("The address you specified was not found. "
24 "Please enter another."))
26 # I don't know if it ever spits out multi-line errors, but might as well
28 def testMultiLineWarning(self
):
32 <table class="warning" width="85%">
34 <td>The address you specified was not found.""" "\n" \
35 """Please enter another.</td>
39 match
= Planner
._error
_rx
.search(text
)
40 self
.assertNotEquals(match
, None)
41 self
.assertEquals(match
.group("msg"),
42 ("The address you specified was not found.\n"
43 "Please enter another."))
45 # This one has a lot of whitespace that we should cut.
46 def testNoItinerariesError(self
):
48 <table cellpadding="0" cellspacing="0" summary="Warning message" class="warning" width="85%">
50 <td><img src="tripPlanning/images/imgWarning.gif"></td>
55 No itineraries could be found.
61 match
= Planner
._error
_rx
.search(text
)
62 self
.assertNotEquals(match
, None)
63 self
.assertEquals(match
.group("msg"), "No itineraries could be found.")
66 if __name__
== '__main__':