diff options
| author | Jason Pellerin <jpellerin@gmail.com> | 2006-07-09 17:11:34 +0000 |
|---|---|---|
| committer | Jason Pellerin <jpellerin@gmail.com> | 2006-07-09 17:11:34 +0000 |
| commit | ef1a9eeb64b24a49769b107a9361643bd7e7a688 (patch) | |
| tree | 35e92a9d96da0e8141ef9bcc18a2b826ca66aae3 /tests | |
| parent | 60947322a582e4bc3f07622024ef7e2d470b0d68 (diff) | |
[multi-db] Merge trunk to [3302]
git-svn-id: http://code.djangoproject.com/svn/django/branches/multiple-db-support@3303 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/othertests/defaultfilters.py | 30 | ||||
| -rw-r--r-- | tests/othertests/templates.py | 16 | ||||
| -rw-r--r-- | tests/regressiontests/many_to_one_regress/__init__.py | 0 | ||||
| -rw-r--r-- | tests/regressiontests/many_to_one_regress/models.py | 13 |
4 files changed, 53 insertions, 6 deletions
diff --git a/tests/othertests/defaultfilters.py b/tests/othertests/defaultfilters.py index 46f2519285..1636b948d0 100644 --- a/tests/othertests/defaultfilters.py +++ b/tests/othertests/defaultfilters.py @@ -313,6 +313,36 @@ False >>> pluralize(2) 's' +>>> pluralize([1]) +'' + +>>> pluralize([]) +'s' + +>>> pluralize([1,2,3]) +'s' + +>>> pluralize(1,'es') +'' + +>>> pluralize(0,'es') +'es' + +>>> pluralize(2,'es') +'es' + +>>> pluralize(1,'y,ies') +'y' + +>>> pluralize(0,'y,ies') +'ies' + +>>> pluralize(2,'y,ies') +'ies' + +>>> pluralize(0,'y,ies,error') +'' + >>> phone2numeric('0800 flowers') '0800 3569377' diff --git a/tests/othertests/templates.py b/tests/othertests/templates.py index c0333c90a6..d3b09c5310 100644 --- a/tests/othertests/templates.py +++ b/tests/othertests/templates.py @@ -78,7 +78,7 @@ TEMPLATE_TESTS = { 'basic-syntax03': ("{{ first }} --- {{ second }}", {"first" : 1, "second" : 2}, "1 --- 2"), # Fail silently when a variable is not found in the current context - 'basic-syntax04': ("as{{ missing }}df", {}, "asdf"), + 'basic-syntax04': ("as{{ missing }}df", {}, "asINVALIDdf"), # A variable may not contain more than one word 'basic-syntax06': ("{{ multi word variable }}", {}, template.TemplateSyntaxError), @@ -94,7 +94,7 @@ TEMPLATE_TESTS = { 'basic-syntax10': ("{{ var.otherclass.method }}", {"var": SomeClass()}, "OtherClass.method"), # Fail silently when a variable's attribute isn't found - 'basic-syntax11': ("{{ var.blech }}", {"var": SomeClass()}, ""), + 'basic-syntax11': ("{{ var.blech }}", {"var": SomeClass()}, "INVALID"), # Raise TemplateSyntaxError when trying to access a variable beginning with an underscore 'basic-syntax12': ("{{ var.__dict__ }}", {"var": SomeClass()}, template.TemplateSyntaxError), @@ -110,10 +110,10 @@ TEMPLATE_TESTS = { 'basic-syntax18': ("{{ foo.bar }}", {"foo" : {"bar" : "baz"}}, "baz"), # Fail silently when a variable's dictionary key isn't found - 'basic-syntax19': ("{{ foo.spam }}", {"foo" : {"bar" : "baz"}}, ""), + 'basic-syntax19': ("{{ foo.spam }}", {"foo" : {"bar" : "baz"}}, "INVALID"), # Fail silently when accessing a non-simple method - 'basic-syntax20': ("{{ var.method2 }}", {"var": SomeClass()}, ""), + 'basic-syntax20': ("{{ var.method2 }}", {"var": SomeClass()}, "INVALID"), # Basic filter usage 'basic-syntax21': ("{{ var|upper }}", {"var": "Django is the greatest!"}, "DJANGO IS THE GREATEST!"), @@ -152,7 +152,7 @@ TEMPLATE_TESTS = { 'basic-syntax32': (r'{{ var|yesno:"yup,nup,mup" }} {{ var|yesno }}', {"var": True}, 'yup yes'), # Fail silently for methods that raise an exception with a "silent_variable_failure" attribute - 'basic-syntax33': (r'1{{ var.method3 }}2', {"var": SomeClass()}, "12"), + 'basic-syntax33': (r'1{{ var.method3 }}2', {"var": SomeClass()}, "1INVALID2"), # In methods that raise an exception without a "silent_variable_attribute" set to True, # the exception propogates @@ -495,7 +495,7 @@ TEMPLATE_TESTS = { '{{ item.foo }}' + \ '{% endfor %},' + \ '{% endfor %}', - {}, ''), + {}, 'INVALID:INVALIDINVALIDINVALIDINVALIDINVALIDINVALIDINVALID,'), ### TEMPLATETAG TAG ####################################################### 'templatetag01': ('{% templatetag openblock %}', {}, '{%'), @@ -579,6 +579,9 @@ def run_tests(verbosity=0, standalone=False): # Turn TEMPLATE_DEBUG off, because tests assume that. old_td, settings.TEMPLATE_DEBUG = settings.TEMPLATE_DEBUG, False + # Set TEMPLATE_STRING_IF_INVALID to a known string + old_invalid, settings.TEMPLATE_STRING_IF_INVALID = settings.TEMPLATE_STRING_IF_INVALID, 'INVALID' + for name, vals in tests: install() if 'LANGUAGE_CODE' in vals[1]: @@ -609,6 +612,7 @@ def run_tests(verbosity=0, standalone=False): loader.template_source_loaders = old_template_loaders deactivate() settings.TEMPLATE_DEBUG = old_td + settings.TEMPLATE_STRING_IF_INVALID = old_invalid if failed_tests and not standalone: msg = "Template tests %s failed." % failed_tests diff --git a/tests/regressiontests/many_to_one_regress/__init__.py b/tests/regressiontests/many_to_one_regress/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/regressiontests/many_to_one_regress/__init__.py diff --git a/tests/regressiontests/many_to_one_regress/models.py b/tests/regressiontests/many_to_one_regress/models.py new file mode 100644 index 0000000000..485e928777 --- /dev/null +++ b/tests/regressiontests/many_to_one_regress/models.py @@ -0,0 +1,13 @@ +from django.db import models + +class First(models.Model): + second = models.IntegerField() + +class Second(models.Model): + first = models.ForeignKey(First, related_name = 'the_first') + +# If ticket #1578 ever slips back in, these models will not be able to be +# created (the field names being lower-cased versions of their opposite +# classes is important here). + +API_TESTS = "" |
