示例#1
0
 def test_non_digit(self):
     try:
         interpolate('*.this.is.*.simply.a.test', '6.this.is.not.correct')
     except ValueError as exception:
         self.assertEqual(str(exception), "Can't interpolate * with non-digit value 'not'.")
         return
     self.fail("Did not raise ValueError on path mismatch.")
示例#2
0
 def test_mismatch_paths(self):
     try:
         interpolate('*.this.is.*.simply.a.test', '6.this.is.666.not.correct')
     except ValueError as exception:
         self.assertEqual(
             str(exception),
             "Can't interpolate *.this.is.*.simply.a.test with 6.this.is.666.not.correct, because paths differ at simply/not."
         )
         return
     self.fail("Did not raise ValueError on path mismatch.")
示例#3
0
 def test_longer_source(self):
     result = interpolate('*.this.is.*.simply.a.test', '6.this.is.3.simply.a.test.8.5.longer.3.is.ignored')
     self.assertEqual(result, '6.this.is.3.simply.a.test')
示例#4
0
 def test_shorter_source(self):
     result = interpolate('*.this.is.*.simply.a.test', '6.this.is.3')
     self.assertEqual(result, '6.this.is.3.simply.a.test')
示例#5
0
 def test_multi_interpolation(self):
     result = interpolate('*.this.is.*.simply.*.test', '6.this.is.3.simply.1.test')
     self.assertEqual(result, '6.this.is.3.simply.1.test')
示例#6
0
 def test_single_interpolation(self):
     result = interpolate('*', '8')
     self.assertEqual(result, '8')