diff options
| -rw-r--r-- | challenge-095/abigail/python/ch-1.py | 13 | ||||
| -rw-r--r-- | challenge-095/abigail/t/ctest.ini | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/challenge-095/abigail/python/ch-1.py b/challenge-095/abigail/python/ch-1.py index 5378ca65f6..baadd38de4 100644 --- a/challenge-095/abigail/python/ch-1.py +++ b/challenge-095/abigail/python/ch-1.py @@ -2,8 +2,17 @@ import fileinput import re for line in fileinput . input (): - line = line . rstrip () - if (re . match (r'^\d+(\.\d+)?$', line) and line == line [::-1]): + # + # Make sure the string is in UTF-8, and remove any newlines + # + line = line . decode ("utf-8") . strip () + + # + # Should look like an unsigned number (possible decimal) + # and be a palindrome. + # + if (re . match (r'^\d+(\.\d+)?$', line, re . UNICODE) and + line == line [::-1]): print 1 else: print 0 diff --git a/challenge-095/abigail/t/ctest.ini b/challenge-095/abigail/t/ctest.ini index b6214f62df..c08015176d 100644 --- a/challenge-095/abigail/t/ctest.ini +++ b/challenge-095/abigail/t/ctest.ini @@ -1,3 +1,7 @@ +#
+# Config file for 'ctest'. See
+# https://github.com/Abigail/Misc/blob/master/ctest
+#
[names]
1-1 = Given examples
1-2 = Test decimal dot
@@ -7,8 +11,8 @@ 2-1 = Given example
2-2 = Test empty stack
-[1-5/node]
+[1-5/node,python]
skip = No script runs assertions available
-[1-4,1-5/c,awk,python]
+[1-4,1-5/c,awk]
skip = No Unicode support
|
