Merge "Fix the incorrect alignment"
This commit is contained in:
@@ -221,10 +221,10 @@ class PrintListTestCase(test_utils.TestCase):
|
|||||||
# Output should be sorted by the first key (a)
|
# Output should be sorted by the first key (a)
|
||||||
self.assertEqual("""\
|
self.assertEqual("""\
|
||||||
+---+-----+
|
+---+-----+
|
||||||
| a | b |
|
| a | b |
|
||||||
+---+-----+
|
+---+-----+
|
||||||
| 1 | c d |
|
| 1 | c d |
|
||||||
| 3 | a |
|
| 3 | a |
|
||||||
+---+-----+
|
+---+-----+
|
||||||
""", cso.read())
|
""", cso.read())
|
||||||
|
|
||||||
@@ -237,12 +237,12 @@ class PrintDictTestCase(test_utils.TestCase):
|
|||||||
utils.print_dict(d)
|
utils.print_dict(d)
|
||||||
self.assertEqual("""\
|
self.assertEqual("""\
|
||||||
+----------+---------------+
|
+----------+---------------+
|
||||||
| Property | Value |
|
| Property | Value |
|
||||||
+----------+---------------+
|
+----------+---------------+
|
||||||
| a | A |
|
| a | A |
|
||||||
| b | B |
|
| b | B |
|
||||||
| c | C |
|
| c | C |
|
||||||
| d | test carriage |
|
| d | test carriage |
|
||||||
| | return |
|
| | return |
|
||||||
+----------+---------------+
|
+----------+---------------+
|
||||||
""", cso.read())
|
""", cso.read())
|
||||||
|
@@ -160,7 +160,7 @@ def print_list(objs, fields, exclude_unavailable=False, formatters=None,
|
|||||||
fields.remove(f)
|
fields.remove(f)
|
||||||
|
|
||||||
pt = prettytable.PrettyTable((f for f in fields), caching=False)
|
pt = prettytable.PrettyTable((f for f in fields), caching=False)
|
||||||
pt.aligns = ['l' for f in fields]
|
pt.align = 'l'
|
||||||
for row in rows:
|
for row in rows:
|
||||||
count = 0
|
count = 0
|
||||||
# Converts unicode values in dictionary to string
|
# Converts unicode values in dictionary to string
|
||||||
@@ -188,7 +188,7 @@ def unicode_key_value_to_string(dictionary):
|
|||||||
|
|
||||||
def print_dict(d, property="Property", formatters=None):
|
def print_dict(d, property="Property", formatters=None):
|
||||||
pt = prettytable.PrettyTable([property, 'Value'], caching=False)
|
pt = prettytable.PrettyTable([property, 'Value'], caching=False)
|
||||||
pt.aligns = ['l', 'l']
|
pt.align = 'l'
|
||||||
formatters = formatters or {}
|
formatters = formatters or {}
|
||||||
|
|
||||||
for r in six.iteritems(d):
|
for r in six.iteritems(d):
|
||||||
|
Reference in New Issue
Block a user