本文整理匯總了Python中Shine.CLI.TextTable.TextTable.title方法的典型用法代碼示例。如果您正苦於以下問題:Python TextTable.title方法的具體用法?Python TextTable.title怎麽用?Python TextTable.title使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Shine.CLI.TextTable.TextTable
的用法示例。
在下文中一共展示了TextTable.title方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_long_title_truncated
# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import title [as 別名]
def test_long_title_truncated(self):
"""very wide data does not imply wery wide title"""
tbl = TextTable("%one %two")
tbl.title = "title"
tbl.append({'one': 'foobar', 'two': ' go' * 100})
self.assertEqual(str(tbl),
"== title =\n"
"ONE TWO\n"
"--- ---\n"
"foobar " + ' go' * 100)
示例2: test_title_with_color
# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import title [as 別名]
def test_title_with_color(self):
"""display with title and color"""
tbl = TextTable("%filesystem %two")
tbl.title = "title"
tbl.color = True
tbl.append({'filesystem': 'foo', 'two': 'bar'})
self.assertEqual(str(tbl),
"====\033[34m title \033[0m===\n"
"\033[34mFILESYSTEM TWO\033[0m\n"
"---------- ---\n"
"foo bar")
示例3: test_title
# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import title [as 別名]
def test_title(self):
"""display with a simple title"""
tbl = TextTable("%one")
tbl.title = "test title"
tbl.append({'one': 'foo'})
self.assertEqual(str(tbl), "= test title =\nONE\n---\nfoo")