py3: Fix deprecation warnings

Fix the deprecation warnings while running the unit tests.
Python3 interprets string literals as unicode strings, so an
"r" is required.

Story: 2006796
Task: 42749

Signed-off-by: Charles Short <charles.short@windriver.com>
Change-Id: I78362e4a8533237b8db19065d6f576121538c8e9
This commit is contained in:
Charles Short 2021-07-02 04:23:04 -04:00
parent c7147c0c90
commit 3d8b5813f6
2 changed files with 8 additions and 8 deletions

View File

@ -644,7 +644,7 @@ def build_wrapping_formatters(objs, fields, field_labels, format_spec, add_blank
if objs is None or len(objs) == 0:
return {}
biggest_word_pattern = re.compile("[\.:,;\!\?\\ =-\_]")
biggest_word_pattern = re.compile(r"[\.:,;\!\?\\ =-\_]")
def get_biggest_word(s):
return max(biggest_word_pattern.split(s), key=len)

View File

@ -78,13 +78,13 @@ class ShellTest(utils.BaseTestCase):
def test_help_on_subcommand(self):
required = [
'.*?^usage: system host-show \[--column COLUMN\] \[--format {table,yaml,value}\]'
'.*?<hostname or id>'
'',
".*?^Show host attributes.",
'',
".*?^Positional arguments:",
".*?<hostname or id> Name or ID of host",
r'.*?^usage: system host-show \[--column COLUMN\] \[--format {table,yaml,value}\]'
r'.*?<hostname or id>'
r'',
r".*?^Show host attributes.",
r'',
r".*?^Positional arguments:",
r".*?<hostname or id> Name or ID of host",
]
argstrings = [
'help host-show',