From de7bff28df45bfe6689e25fb479bdc33de153e6d Mon Sep 17 00:00:00 2001 From: Romain Giot Date: Sat, 19 Oct 2013 15:34:13 +0200 Subject: [PATCH] Update tests to make test -a option only when unidecode is installed --- test.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/test.py b/test.py index 636855a..af5a70e 100755 --- a/test.py +++ b/test.py @@ -40,6 +40,12 @@ import subprocess from textwrap import dedent +try: + import unidecode + UNIDECODE_IMPORTED = True +except ImportError: + UNIDECODE_IMPORTED = False + # Some constants for better reading BS = '\x7f' ESC = '\x1b' @@ -1472,14 +1478,16 @@ class Transformation_CleverTransformLongLower_ExceptCorrectResult(_VimTest): snippets = ("test", "$1 ${1/(.*)/\L$1\E/}") keys = "test" + EX + "HALLO" wanted = "HALLO hallo" -class Transformation_SimpleCaseAsciiResult(_VimTest): - snippets = ("ascii", "$1 ${1/(.*)/$1/a}") - keys = "ascii" + EX + "éèàçôïÉÈÀÇÔÏ€" - wanted = "éèàçôïÉÈÀÇÔÏ€ eeacoiEEACOIEU" -class Transformation_LowerCaseAsciiResult(_VimTest): - snippets = ("ascii", "$1 ${1/(.*)/\L$1\E/a}") - keys = "ascii" + EX + "éèàçôïÉÈÀÇÔÏ€" - wanted = "éèàçôïÉÈÀÇÔÏ€ eeacoieeacoieu" + +if UNIDECODE_IMPORTED: + class Transformation_SimpleCaseAsciiResult(_VimTest): + snippets = ("ascii", "$1 ${1/(.*)/$1/a}") + keys = "ascii" + EX + "éèàçôïÉÈÀÇÔÏ€" + wanted = "éèàçôïÉÈÀÇÔÏ€ eeacoiEEACOIEU" + class Transformation_LowerCaseAsciiResult(_VimTest): + snippets = ("ascii", "$1 ${1/(.*)/\L$1\E/a}") + keys = "ascii" + EX + "éèàçôïÉÈÀÇÔÏ€" + wanted = "éèàçôïÉÈÀÇÔÏ€ eeacoieeacoieu" class Transformation_ConditionalInsertionSimple_ExceptCorrectResult(_VimTest): snippets = ("test", "$1 ${1/(^a).*/(?0:began with an a)/}")