summaryrefslogtreecommitdiff
path: root/prettytable
diff options
context:
space:
mode:
authorkxxoling <kxxoling@gmail.com>2016-07-13 14:47:50 +0800
committerkxxoling <kxxoling@gmail.com>2016-07-13 14:47:50 +0800
commit3d27216da43548681a2ca4374e8966de9408ac22 (patch)
treef2b4d948589fc933eb82b130f44038373b3dbf48 /prettytable
parent495b46c731f94cf2ad3ed13eb013d395cc3932c3 (diff)
downloadpython-prettytable-ptable-3d27216da43548681a2ca4374e8966de9408ac22.tar.gz
Fix failed tests
Diffstat (limited to 'prettytable')
-rw-r--r--prettytable/prettytable.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/prettytable/prettytable.py b/prettytable/prettytable.py
index bb6e16f..3b9bf27 100644
--- a/prettytable/prettytable.py
+++ b/prettytable/prettytable.py
@@ -472,14 +472,18 @@ class PrettyTable(object):
Arguments:
min_width - minimum width integer"""
+ if self.header:
+ fields = self._field_names
+ else:
+ fields = self._rows[0] if self._rows else []
result = {
# minimum column width can't be lesser
# than header's length
name: max(
- len(name),
+ _str_block_width(unicode_(name)),
self._min_width.get(name, 0)
)
- for name in self._field_names
+ for name in fields
}
return result