def test_format(self):
     self.assertJson(
         query.format("%s %d and then %.2f", 'Hey there', 2019, 3.14),
         '{"format":"%s %d and then %.2f","values":["Hey there",2019,3.14]}'
     )
     self.assertJson(query.format("always 100%%"),
                     '{"format":"always 100%%","values":[]}')
示例#2
0
 def test_format(self):
     self.assertEqual(self._q(query.format("always 100%%")), "always 100%")
     self.assertEqual(
         self._q(
             query.format("Hi there %s, you have %d points", "Tom", 9000)),
         "Hi there Tom, you have 9000 points")
     self.assertEqual(self._q(query.format("%.2f %.5f", 3.14159, 3.14159)),
                      "3.14 3.14159")