diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-31 21:18:28 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-03-31 21:20:52 +0300 |
commit | 4db727afea0082780fca558ff251afb4a8b32ad7 (patch) | |
tree | cbb301444776b42c6a0e5d70a6d5082f4bf972fb /tests/basics/string-format-modulo.py | |
parent | 6ce78c4fae1a740128efcde74b222593f13a12f4 (diff) | |
download | micropython-4db727afea0082780fca558ff251afb4a8b32ad7.tar.gz micropython-4db727afea0082780fca558ff251afb4a8b32ad7.zip |
objstr: Very basic implementation of % string formatting operator.
Diffstat (limited to 'tests/basics/string-format-modulo.py')
-rw-r--r-- | tests/basics/string-format-modulo.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/basics/string-format-modulo.py b/tests/basics/string-format-modulo.py new file mode 100644 index 0000000000..0b50c2674a --- /dev/null +++ b/tests/basics/string-format-modulo.py @@ -0,0 +1,22 @@ +print("=%s=" % 1) +print("=%s=%s=" % (1, 2)) +print("=%s=" % (1,)) +print("=%s=" % [1, 2]) + +print("=%s=" % "str") +print("=%r=" % "str") + +try: + print("=%s=%s=" % 1) +except TypeError: + print("TypeError") + +try: + print("=%s=%s=%s=" % (1, 2)) +except TypeError: + print("TypeError") + +try: + print("=%s=" % (1, 2)) +except TypeError: + print("TypeError") |