Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/azure/cli/_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def get_formatter(format_type):
class ListOutput(object): #pylint: disable=too-few-public-methods

# Match the capital letters in a camel case string
FORMAT_KEYS_PATTERN = re.compile('([A-Z][^A-Z]*)')
FORMAT_KEYS_PATTERN = re.compile('([A-Z]+(?![a-z])|[A-Z]{1}[a-z]+)')

def __init__(self):
self._formatted_keys_cache = {}
Expand Down
12 changes: 11 additions & 1 deletion src/azure/cli/tests/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ def test_out_list_valid(self):
Id : 0b1f6472


"""))

def test_out_list_valid_caps(self):
output_producer = OutputProducer(formatter=format_list, file=self.io)
output_producer.out(CommandResultItem({'active': True, 'TESTStuff': 'blah'}))
self.assertEqual(util.normalize_newlines(self.io.getvalue()), util.normalize_newlines(
"""Test Stuff : blah
Active : True


"""))

def test_out_list_valid_none_val(self):
Expand Down Expand Up @@ -232,7 +242,7 @@ def test_out_list_format_key_multiple_caps(self):
lo = ListOutput()
self.assertEqual(lo._formatted_keys_cache, {})
lo._get_formatted_key('fooIDS')
self.assertEqual(lo._formatted_keys_cache, {'fooIDS': 'Foo I D S'})
self.assertEqual(lo._formatted_keys_cache, {'fooIDS': 'Foo Ids'})

def test_out_list_format_key_multiple_words(self):
lo = ListOutput()
Expand Down