Beispiel #1
0
 def test_quotes(self):
     value = reverse_template_js(r'\'"')
     expected = '''function(fields){return ""+"'"+'"';}'''
     print '>', expected, '<'
     print '>', value, '<'
     assert value == expected, value
Beispiel #2
0
 def test_values(self):
     value = reverse_template_js(r'(?P<foo>\d+)aa')
     expected = '''function(fields){return ""+fields["foo"]+"aa";}'''
     print '>', expected, '<'
     print '>', value, '<'
     assert value == expected, value
Beispiel #3
0
 def test_js_simple(self):
     value = reverse_template_js(r'a')
     assert value == 'function(fields){return ""+"a";}', value
Beispiel #4
0
 def _compile(self):
     self.js_pattern = reverse_template_js(self.pattern)
     self.py_pattern = reverse_template(self.pattern)
     self.group_map = reverse_group_map(self.pattern)