From da02739699aa8db534d2f2620ba37a5c2ad0245a Mon Sep 17 00:00:00 2001 From: dgw Date: Sun, 18 Oct 2020 22:03:45 -0500 Subject: [PATCH] test_modules_choose: we'll aspire to fix these XFAIL tests someday --- test/modules/test_modules_choose.py | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/modules/test_modules_choose.py b/test/modules/test_modules_choose.py index 21133f2d3c..43377a14a4 100644 --- a/test/modules/test_modules_choose.py +++ b/test/modules/test_modules_choose.py @@ -54,3 +54,36 @@ def test_format_safe(text, cleaned): """Test expected formatting-safe string sanitization.""" assert choose._format_safe(text) == cleaned + + +# --- Insert reset only when necessary | Expected to fail --- # + +EFFICIENT_PAIRS = ( + # whitespace inside formatting (kept) + ('\x02 leading space inside formatting\x02', + '\x02 leading space inside formatting\x02'), + ('\x02trailing space inside formatting \x02', + '\x02trailing space inside formatting \x02'), + ('\x02 leading AND trailing inside formatting \x02', + '\x02 leading AND trailing inside formatting \x02'), + # whitespace outside formatting (dropped) + (' \x02leading space outside formatting\x02', + '\x02leading space outside formatting\x02'), + ('\x02trailing space outside formatting\x02 ', + '\x02trailing space outside formatting\x02'), + # whitespace both inside and outside formatting + # (respectively kept and dropped) + (' \x02 leading space inside AND outside\x02', + '\x02 leading space inside AND outside\x02'), + ('\x02trailing space inside AND outside \x02 ', + '\x02trailing space inside AND outside \x02'), + (' \x02 leading AND trailing inside AND outside \x02 ', + '\x02 leading AND trailing inside AND outside \x02'), +) + + +@pytest.mark.parametrize('text, cleaned', EFFICIENT_PAIRS) +@pytest.mark.xfail(strict=True) +def test_format_safe_future(text, cleaned): + """Test future aspirations of efficiency.""" + assert choose._format_safe(text) == cleaned