Пример #1
0
 def test_exceptionviews__ValidationErrorView__3(self):
     """It quotes HTML characters correctly."""
     err = ValidationError(u"The <error> & me.")
     view = ValidationErrorView(err, None)
     self.assertEqual(
         view.snippet(),
         '<span class="error">The &lt;error&gt; &amp; me.</span>')
Пример #2
0
 def test_exceptionviews__ValidationErrorView__4(self):
     """It converts the exception argument of an ConversionError as well."""
     err = ConversionError(ValidationError("not valid"))
     view = ValidationErrorView(err, None)
     self.assertEqual(
         view.snippet(), '<span class="error">not valid</span>')
Пример #3
0
 def test_exceptionviews__ValidationErrorView__2(self):
     """It converts also unicode an html snippet."""
     err = ValidationError(u"Fälscher!")
     view = ValidationErrorView(err, None)
     self.assertEqual(
         view.snippet(), u'<span class="error">Fälscher!</span>')
Пример #4
0
 def test_exceptionviews__ValidationErrorView__1(self):
     """It converts an invariant error to an html snippet."""
     err = ValidationError("Bad error!  Bad!")
     view = ValidationErrorView(err, None)
     self.assertEqual(
         view.snippet(), '<span class="error">Bad error!  Bad!</span>')