Ticket #11288: numerictests.patch

File numerictests.patch, 1.4 KB (added by Stephen Kelly, 15 years ago)

Tests for resolving number-like varaibles.

  • tests/regressiontests/templates/tests.py

     
    341341            'basic-syntax26': (r'{{ "\"fred\"" }}', {}, "\"fred\""),
    342342            'basic-syntax27': (r'{{ _("\"fred\"") }}', {}, "\"fred\""),
    343343
     344            # Something that starts like a number but has an extra lookup works as a lookup.
     345            'basic-syntax28': ("{{ 1.2.3 }}", {"1": {"2": {"3": "d"}}}, "d"),
     346            'basic-syntax29': ("{{ 1.2.3 }}", {"1": {"2": ("a", "b", "c", "d")}}, "d"),
     347            'basic-syntax30': ("{{ 1.2.3 }}", {"1": (("x", "x", "x", "x"), ("y", "y", "y", "y"), ("a", "b", "c", "d"))}, "d"),
     348            'basic-syntax31': ("{{ 1.2.3 }}", {"1": ("xxxx", "yyyy", "abcd")}, "d"),
     349            'basic-syntax32': ("{{ 1.2.3 }}", {"1": ({"x": "x"}, {"y": "y"}, {"z": "z", "3": "d"})}, "d"),
     350
     351            # Numbers are numbers even if their digits are in the context.
     352            'basic-syntax33': ("{{ 1 }}", {"1": "abc"}, "1"),
     353            'basic-syntax34': ("{{ 1.2 }}", {"1": "abc"}, "1.2"),
     354
    344355            # List-index syntax allows a template to access a certain item of a subscriptable object.
    345356            'list-index01': ("{{ var.1 }}", {"var": ["first item", "second item"]}, "second item"),
    346357
Back to Top