示例#1
0
 def test_empty_format(self):
     self.assertEqual([], utils.extract_pattern(''))
示例#2
0
 def test_repeated(self):
     self.assertEqual(['aa'], utils.extract_pattern('%(aa)s %(aa)d %(aa)s'))
示例#3
0
 def test_partial(self):
     """Interpolation fails mid-way."""
     self.assertEqual(['aa'], utils.extract_pattern('%(aa)s %d %(bbb)d'))
示例#4
0
 def test_non_dict(self):
     self.assertEqual([], utils.extract_pattern('%s %d'))
示例#5
0
 def test_success(self):
     self.assertEqual(['aa', 'bbb'],
                      utils.extract_pattern('%(aa)s %(bbb)d %%(c)s'))
示例#6
0
 def test_empty_format(self):
     self.assertEqual(set(), utils.extract_pattern(''))
示例#7
0
 def test_newstyle_format(self):
     self.assertEqual([], utils.extract_pattern('{foo}, {0}'))
示例#8
0
 def test_partial(self):
     """Interpolation fails mid-way."""
     self.assertEqual({'aa'}, utils.extract_pattern('%(aa)s %d %(bbb)d'))
示例#9
0
 def test_repeated(self):
     self.assertEqual({'aa'}, utils.extract_pattern('%(aa)s %(aa)d %(aa)s'))
示例#10
0
 def test_success(self):
     self.assertEqual({'aa', 'bbb'},
         utils.extract_pattern('%(aa)s %(bbb)d %%(c)s'))
示例#11
0
 def test_non_dict(self):
     self.assertEqual(set(), utils.extract_pattern('%s %d'))
示例#12
0
 def test_newstyle_format(self):
     self.assertEqual(set(), utils.extract_pattern('{foo}, {0}'))