Ticket #13275: t13275.tests.diff

File t13275.tests.diff, 4.5 KB (added by Russell Keith-Magee, 15 years ago)

Tests for some regressions introduced by r12889

  • tests/regressiontests/templates/tests.py

    diff -r 58668fc33ea9 tests/regressiontests/templates/tests.py
    a b  
    364364                settings.TEMPLATE_STRING_IF_INVALID = invalid_str
    365365                for is_cached in (False, True):
    366366                    try:
     367                        start = datetime.now()
    367368                        test_template = loader.get_template(name)
     369                        end = datetime.now()
    368370                        output = self.render(test_template, vals)
     371                        if end-start > timedelta(seconds=0.1):
     372                            failures.append("Template test (Cached='%s', TEMPLATE_STRING_IF_INVALID='%s'): %s -- FAILED. Took too long to parse test" % (is_cached, invalid_str, name))
    369373                    except ContextStackException:
    370374                        failures.append("Template test (Cached='%s', TEMPLATE_STRING_IF_INVALID='%s'): %s -- FAILED. Context stack was left imbalanced" % (is_cached, invalid_str, name))
    371375                        continue
     
    11751179            # Successes
    11761180            'legacyurl02': ('{% url regressiontests.templates.views.client_action id=client.id,action="update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
    11771181            'legacyurl02a': ('{% url regressiontests.templates.views.client_action client.id,"update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
     1182            'legacyurl02b': ("{% url regressiontests.templates.views.client_action id=client.id,action='update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
     1183            'legacyurl02c': ("{% url regressiontests.templates.views.client_action client.id,'update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
    11781184            'legacyurl10': ('{% url regressiontests.templates.views.client_action id=client.id,action="two words" %}', {'client': {'id': 1}}, '/url_tag/client/1/two%20words/'),
    11791185            'legacyurl13': ('{% url regressiontests.templates.views.client_action id=client.id, action=arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'),
    11801186            'legacyurl14': ('{% url regressiontests.templates.views.client_action client.id, arg|join:"-" %}', {'client': {'id': 1}, 'arg':['a','b']}, '/url_tag/client/1/a-b/'),
     1187            'legacyurl16': ('{% url regressiontests.templates.views.client_action action="update",id="1" %}', {}, '/url_tag/client/1/update/'),
     1188            'legacyurl16a': ("{% url regressiontests.templates.views.client_action action='update',id='1' %}", {}, '/url_tag/client/1/update/'),
     1189            'legacyurl17': ('{% url regressiontests.templates.views.client_action client_id=client.my_id,action=action %}', {'client': {'my_id': 1}, 'action': 'update'}, '/url_tag/client/1/update/'),
    11811190
    11821191            'url01': ('{% url regressiontests.templates.views.client client.id %}', {'client': {'id': 1}}, '/url_tag/client/1/'),
    11831192            'url02': ('{% url regressiontests.templates.views.client_action id=client.id action="update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
    11841193            'url02a': ('{% url regressiontests.templates.views.client_action client.id "update" %}', {'client': {'id': 1}}, '/url_tag/client/1/update/'),
     1194            'url02b': ("{% url regressiontests.templates.views.client_action id=client.id action='update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
     1195            'url02c': ("{% url regressiontests.templates.views.client_action client.id 'update' %}", {'client': {'id': 1}}, '/url_tag/client/1/update/'),
    11851196            'url03': ('{% url regressiontests.templates.views.index %}', {}, '/url_tag/'),
    11861197            'url04': ('{% url named.client client.id %}', {'client': {'id': 1}}, '/url_tag/named-client/1/'),
    11871198            'url05': (u'{% url метка_оператора v %}', {'v': u'Ω'}, '/url_tag/%D0%AE%D0%BD%D0%B8%D0%BA%D0%BE%D0%B4/%CE%A9/'),
  • tests/regressiontests/templates/urls.py

    diff -r 58668fc33ea9 tests/regressiontests/templates/urls.py
    a b  
    88    (r'^$', views.index),
    99    (r'^client/(\d+)/$', views.client),
    1010    (r'^client/(?P<id>\d+)/(?P<action>[^/]+)/$', views.client_action),
     11    (r'^client/(?P<client_id>\d+)/(?P<action>[^/]+)/$', views.client_action),
    1112    url(r'^named-client/(\d+)/$', views.client2, name="named.client"),
    1213
    1314    # Unicode strings are permitted everywhere.
Back to Top