Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

string_formatting_py27.py 930B

12345678910111213141516171819202122
  1. """test for Python 2 string formatting error
  2. """
  3. from __future__ import unicode_literals
  4. # pylint: disable=line-too-long
  5. __revision__ = 1
  6. def pprint_bad():
  7. """Test string format """
  8. "{{}}".format(1) # [too-many-format-args]
  9. "{} {".format() # [bad-format-string]
  10. "{} }".format() # [bad-format-string]
  11. "{0} {}".format(1, 2) # [format-combined-specification]
  12. # +1: [missing-format-argument-key, unused-format-string-argument]
  13. "{a} {b}".format(a=1, c=2)
  14. "{} {a}".format(1, 2) # [missing-format-argument-key]
  15. "{} {}".format(1) # [too-few-format-args]
  16. "{} {}".format(1, 2, 3) # [too-many-format-args]
  17. # +1: [missing-format-argument-key,missing-format-argument-key,missing-format-argument-key]
  18. "{a} {b} {c}".format()
  19. "{} {}".format(a=1, b=2) # [too-few-format-args]
  20. # +1: [missing-format-argument-key, missing-format-argument-key]
  21. "{a} {b}".format(1, 2)