Test Interpolation equality. The *i* argument must be an Interpolation instance. The *exp* argument must be a tuple of the form (value, expression, conversion, format_spec) where the final three items may be omitted and are assumed to be '', None and '' respectively
(self, i, exp)
| 3 | |
| 4 | class TStringBaseCase: |
| 5 | def assertInterpolationEqual(self, i, exp): |
| 6 | """Test Interpolation equality. |
| 7 | |
| 8 | The *i* argument must be an Interpolation instance. |
| 9 | |
| 10 | The *exp* argument must be a tuple of the form |
| 11 | (value, expression, conversion, format_spec) where the final three |
| 12 | items may be omitted and are assumed to be '', None and '' respectively. |
| 13 | """ |
| 14 | if len(exp) == 4: |
| 15 | actual = (i.value, i.expression, i.conversion, i.format_spec) |
| 16 | self.assertEqual(actual, exp) |
| 17 | elif len(exp) == 3: |
| 18 | self.assertEqual((i.value, i.expression, i.conversion), exp) |
| 19 | self.assertEqual(i.format_spec, "") |
| 20 | elif len(exp) == 2: |
| 21 | self.assertEqual((i.value, i.expression), exp) |
| 22 | self.assertEqual(i.conversion, None) |
| 23 | self.assertEqual(i.format_spec, "") |
| 24 | elif len(exp) == 1: |
| 25 | self.assertEqual((i.value,), exp) |
| 26 | self.assertEqual(i.expression, "") |
| 27 | self.assertEqual(i.conversion, None) |
| 28 | self.assertEqual(i.format_spec, "") |
| 29 | |
| 30 | def assertTStringEqual(self, t, strings, interpolations): |
| 31 | """Test template string literal equality. |