コード例 #1
0
 def test_nbsp(self):
     """Test that spaces are replaced with nbsp."""
     text = 'foo bar baz'
     expected = Markup('foo bar baz')
     result = nbsp(text)
     assert result == expected
コード例 #2
0
 def test_nbsp_escapes(self):
     """Ensure the filter escapes HTML."""
     text = 'foo bar baz <script>'
     expected = Markup('foo&nbsp;bar&nbsp;baz&nbsp;&lt;script&gt;')
     result = nbsp(text)
     assert result == expected
コード例 #3
0
 def test_nbsp_with_markup(self):
     """When markup passed in should still return markup."""
     text = Markup('foo bar baz <script>')
     expected = Markup('foo&nbsp;bar&nbsp;baz&nbsp;<script>')
     result = nbsp(text)
     assert result == expected