mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	newforms-admin: Merged to [5300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@5301 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -3516,6 +3516,15 @@ u'\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111' | ||||
| u'1' | ||||
| >>> smart_unicode('foo') | ||||
| u'foo' | ||||
|  | ||||
| # flatatt tests | ||||
| >>> from django.newforms.util import flatatt | ||||
| >>> flatatt({'id': "header"}) | ||||
| u' id="header"' | ||||
| >>> flatatt({'class': "news", 'title': "Read this"}) | ||||
| u' class="news" title="Read this"' | ||||
| >>> flatatt({}) | ||||
| u'' | ||||
| """ | ||||
|  | ||||
| __test__ = { | ||||
|   | ||||
| @@ -166,6 +166,9 @@ True | ||||
| >>> q.pop('foo') | ||||
| ['bar', 'baz', 'another', 'hello'] | ||||
|  | ||||
| >>> q.pop('foo', 'not there') | ||||
| 'not there' | ||||
|  | ||||
| >>> q.get('foo', 'not there') | ||||
| 'not there' | ||||
|  | ||||
|   | ||||
| @@ -1,69 +0,0 @@ | ||||
| # Quick tests for the markup templatetags (django.contrib.markup) | ||||
|  | ||||
| from django.template import Template, Context, add_to_builtins | ||||
| import re | ||||
| import unittest | ||||
|  | ||||
| add_to_builtins('django.contrib.markup.templatetags.markup') | ||||
|  | ||||
| class Templates(unittest.TestCase): | ||||
|     def test_textile(self): | ||||
|         try: | ||||
|             import textile | ||||
|         except ImportError: | ||||
|             textile = None | ||||
|  | ||||
|         textile_content = """Paragraph 1 | ||||
|  | ||||
| Paragraph 2 with "quotes" and @code@""" | ||||
|  | ||||
|         t = Template("{{ textile_content|textile }}") | ||||
|         rendered = t.render(Context(locals())).strip() | ||||
|         if textile: | ||||
|             self.assertEqual(rendered, """<p>Paragraph 1</p> | ||||
|  | ||||
| <p>Paragraph 2 with “quotes” and <code>code</code></p>""") | ||||
|         else: | ||||
|             self.assertEqual(rendered, textile_content) | ||||
|  | ||||
|     def test_markdown(self): | ||||
|         try: | ||||
|             import markdown | ||||
|         except ImportError: | ||||
|             markdown = None | ||||
|  | ||||
|         markdown_content = """Paragraph 1 | ||||
|  | ||||
| ## An h2""" | ||||
|  | ||||
|         t = Template("{{ markdown_content|markdown }}") | ||||
|         rendered = t.render(Context(locals())).strip() | ||||
|         if markdown: | ||||
|             pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""") | ||||
|             self.assert_(pattern.match(rendered)) | ||||
|         else: | ||||
|             self.assertEqual(rendered, markdown_content) | ||||
|  | ||||
|     def test_docutils(self): | ||||
|         try: | ||||
|             import docutils | ||||
|         except ImportError: | ||||
|             docutils = None | ||||
|  | ||||
|         rest_content = """Paragraph 1 | ||||
|  | ||||
| Paragraph 2 with a link_ | ||||
|  | ||||
| .. _link: http://www.example.com/""" | ||||
|  | ||||
|         t = Template("{{ rest_content|restructuredtext }}") | ||||
|         rendered = t.render(Context(locals())).strip() | ||||
|         if docutils: | ||||
|             self.assertEqual(rendered, """<p>Paragraph 1</p> | ||||
| <p>Paragraph 2 with a <a class="reference" href="http://www.example.com/">link</a></p>""") | ||||
|         else: | ||||
|             self.assertEqual(rendered, rest_content) | ||||
|  | ||||
|  | ||||
| if __name__ == '__main__': | ||||
|     unittest.main() | ||||
		Reference in New Issue
	
	Block a user