def test_not_all_used(self): fmt = "The value of x is %(x)s" text = format(fmt,x=3,y=5) self.assertEqual(text,"""\ The value of x is 3 Additional arguments: y = 5 """)
def test_unknown(self): fmt = "The value of x is %(z)s" text = format(fmt,x=3,y=5) self.assertEqual(text,"""\ The value of x is <UNKNOWN PARAMETER z> Additional arguments: x = 3 y = 5 """)
def test_all_used(self): fmt = """\ The value of x is %(x)s. And y is %(y)s! """ text = format(fmt,x=3,y=5) self.assertEqual(text,"""\ The value of x is 3. And y is 5! """)