Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Removing unecessary unicode prefix.
Browse files Browse the repository at this point in the history
Only including it when required, instead of for everything. Shorter
lines of code.
  • Loading branch information
Robpol86 committed May 15, 2016
1 parent 990a4a1 commit 64ac27e
Showing 1 changed file with 87 additions and 87 deletions.
174 changes: 87 additions & 87 deletions tests/test_width_and_alignment/test_align_and_pad_cell.py
Expand Up @@ -10,43 +10,43 @@


@pytest.mark.parametrize('string,align,width,expected', [
(u'test', '', 4, u'test'),
(Color(u'{blue}Test{/blue}'), '', 4, u'\x1b[34mTest\x1b[39m'),
(Fore.BLUE + u'Test' + Fore.RESET, '', 4, u'\x1b[34mTest\x1b[39m'),
(colored(u'Test', 'blue'), '', 4, u'\x1b[34mTest\x1b[0m'),
(u'蓝色', '', 4, u'蓝色'),
('test', '', 4, 'test'),
(Color('{blue}Test{/blue}'), '', 4, '\x1b[34mTest\x1b[39m'),
(Fore.BLUE + 'Test' + Fore.RESET, '', 4, '\x1b[34mTest\x1b[39m'),
(colored('Test', 'blue'), '', 4, '\x1b[34mTest\x1b[0m'),
('蓝色', '', 4, '蓝色'),
(u'שלום', '', 4, u'\u05e9\u05dc\u05d5\u05dd'),
(u'معرب', '', 4, u'\u0645\u0639\u0631\u0628'),
(u'test', '', 5, u'test '),
(Color(u'{blue}Test{/blue}'), '', 5, u'\x1b[34mTest\x1b[39m '),
(Fore.BLUE + u'Test' + Fore.RESET, '', 5, u'\x1b[34mTest\x1b[39m '),
(colored(u'Test', 'blue'), '', 5, u'\x1b[34mTest\x1b[0m '),
(u'蓝色', '', 5, u'蓝色 '),
('test', '', 5, 'test '),
(Color('{blue}Test{/blue}'), '', 5, '\x1b[34mTest\x1b[39m '),
(Fore.BLUE + 'Test' + Fore.RESET, '', 5, '\x1b[34mTest\x1b[39m '),
(colored('Test', 'blue'), '', 5, '\x1b[34mTest\x1b[0m '),
('蓝色', '', 5, '蓝色 '),
(u'שלום', '', 5, u'\u05e9\u05dc\u05d5\u05dd '),
(u'معرب', '', 5, u'\u0645\u0639\u0631\u0628 '),
(u'test', 'left', 5, u'test '),
(Color(u'{blue}Test{/blue}'), 'left', 5, u'\x1b[34mTest\x1b[39m '),
(Fore.BLUE + u'Test' + Fore.RESET, 'left', 5, u'\x1b[34mTest\x1b[39m '),
(colored(u'Test', 'blue'), 'left', 5, u'\x1b[34mTest\x1b[0m '),
(u'蓝色', 'left', 5, u'蓝色 '),
('test', 'left', 5, 'test '),
(Color('{blue}Test{/blue}'), 'left', 5, '\x1b[34mTest\x1b[39m '),
(Fore.BLUE + 'Test' + Fore.RESET, 'left', 5, '\x1b[34mTest\x1b[39m '),
(colored('Test', 'blue'), 'left', 5, '\x1b[34mTest\x1b[0m '),
('蓝色', 'left', 5, '蓝色 '),
(u'שלום', 'left', 5, u'\u05e9\u05dc\u05d5\u05dd '),
(u'معرب', 'left', 5, u'\u0645\u0639\u0631\u0628 '),
(u'test', 'right', 5, u' test'),
(Color(u'{blue}Test{/blue}'), 'right', 5, u' \x1b[34mTest\x1b[39m'),
(Fore.BLUE + u'Test' + Fore.RESET, 'right', 5, u' \x1b[34mTest\x1b[39m'),
(colored(u'Test', 'blue'), 'right', 5, u' \x1b[34mTest\x1b[0m'),
(u'蓝色', 'right', 5, u' 蓝色'),
('test', 'right', 5, ' test'),
(Color('{blue}Test{/blue}'), 'right', 5, ' \x1b[34mTest\x1b[39m'),
(Fore.BLUE + 'Test' + Fore.RESET, 'right', 5, ' \x1b[34mTest\x1b[39m'),
(colored('Test', 'blue'), 'right', 5, ' \x1b[34mTest\x1b[0m'),
('蓝色', 'right', 5, ' 蓝色'),
(u'שלום', 'right', 5, u' \u05e9\u05dc\u05d5\u05dd'),
(u'معرب', 'right', 5, u' \u0645\u0639\u0631\u0628'),
(u'test', 'center', 6, u' test '),
(Color(u'{blue}Test{/blue}'), 'center', 6, u' \x1b[34mTest\x1b[39m '),
(Fore.BLUE + u'Test' + Fore.RESET, 'center', 6, u' \x1b[34mTest\x1b[39m '),
(colored(u'Test', 'blue'), 'center', 6, u' \x1b[34mTest\x1b[0m '),
(u'蓝色', 'center', 6, u' 蓝色 '),
('test', 'center', 6, ' test '),
(Color('{blue}Test{/blue}'), 'center', 6, ' \x1b[34mTest\x1b[39m '),
(Fore.BLUE + 'Test' + Fore.RESET, 'center', 6, ' \x1b[34mTest\x1b[39m '),
(colored('Test', 'blue'), 'center', 6, ' \x1b[34mTest\x1b[0m '),
('蓝色', 'center', 6, ' 蓝色 '),
(u'שלום', 'center', 6, u' \u05e9\u05dc\u05d5\u05dd '),
(u'معرب', 'center', 6, u' \u0645\u0639\u0631\u0628 '),
])
Expand All @@ -63,43 +63,43 @@ def test_width(string, align, width, expected):


@pytest.mark.parametrize('string,align,height,expected', [
(u'test', '', 1, u'test'),
(Color(u'{blue}Test{/blue}'), '', 1, u'\x1b[34mTest\x1b[39m'),
(Fore.BLUE + u'Test' + Fore.RESET, '', 1, u'\x1b[34mTest\x1b[39m'),
(colored(u'Test', 'blue'), '', 1, u'\x1b[34mTest\x1b[0m'),
(u'蓝色', '', 1, u'蓝色'),
('test', '', 1, 'test'),
(Color('{blue}Test{/blue}'), '', 1, '\x1b[34mTest\x1b[39m'),
(Fore.BLUE + 'Test' + Fore.RESET, '', 1, '\x1b[34mTest\x1b[39m'),
(colored('Test', 'blue'), '', 1, '\x1b[34mTest\x1b[0m'),
('蓝色', '', 1, '蓝色'),
(u'שלום', '', 1, u'\u05e9\u05dc\u05d5\u05dd'),
(u'معرب', '', 1, u'\u0645\u0639\u0631\u0628'),
(u'test', '', 2, u'test\n '),
(Color(u'{blue}Test{/blue}'), '', 2, u'\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + u'Test' + Fore.RESET, '', 2, u'\x1b[34mTest\x1b[39m\n '),
(colored(u'Test', 'blue'), '', 2, u'\x1b[34mTest\x1b[0m\n '),
(u'蓝色', '', 2, u'蓝色\n '),
('test', '', 2, 'test\n '),
(Color('{blue}Test{/blue}'), '', 2, '\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + 'Test' + Fore.RESET, '', 2, '\x1b[34mTest\x1b[39m\n '),
(colored('Test', 'blue'), '', 2, '\x1b[34mTest\x1b[0m\n '),
('蓝色', '', 2, '蓝色\n '),
(u'שלום', '', 2, u'\u05e9\u05dc\u05d5\u05dd\n '),
(u'معرب', '', 2, u'\u0645\u0639\u0631\u0628\n '),
(u'test', 'top', 2, u'test\n '),
(Color(u'{blue}Test{/blue}'), 'top', 2, u'\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + u'Test' + Fore.RESET, 'top', 2, u'\x1b[34mTest\x1b[39m\n '),
(colored(u'Test', 'blue'), 'top', 2, u'\x1b[34mTest\x1b[0m\n '),
(u'蓝色', 'top', 2, u'蓝色\n '),
('test', 'top', 2, 'test\n '),
(Color('{blue}Test{/blue}'), 'top', 2, '\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + 'Test' + Fore.RESET, 'top', 2, '\x1b[34mTest\x1b[39m\n '),
(colored('Test', 'blue'), 'top', 2, '\x1b[34mTest\x1b[0m\n '),
('蓝色', 'top', 2, '蓝色\n '),
(u'שלום', 'top', 2, u'\u05e9\u05dc\u05d5\u05dd\n '),
(u'معرب', 'top', 2, u'\u0645\u0639\u0631\u0628\n '),
(u'test', 'bottom', 2, u' \ntest'),
(Color(u'{blue}Test{/blue}'), 'bottom', 2, u' \n\x1b[34mTest\x1b[39m'),
(Fore.BLUE + u'Test' + Fore.RESET, 'bottom', 2, u' \n\x1b[34mTest\x1b[39m'),
(colored(u'Test', 'blue'), 'bottom', 2, u' \n\x1b[34mTest\x1b[0m'),
(u'蓝色', 'bottom', 2, u' \n蓝色'),
('test', 'bottom', 2, ' \ntest'),
(Color('{blue}Test{/blue}'), 'bottom', 2, ' \n\x1b[34mTest\x1b[39m'),
(Fore.BLUE + 'Test' + Fore.RESET, 'bottom', 2, ' \n\x1b[34mTest\x1b[39m'),
(colored('Test', 'blue'), 'bottom', 2, ' \n\x1b[34mTest\x1b[0m'),
('蓝色', 'bottom', 2, ' \n蓝色'),
(u'שלום', 'bottom', 2, u' \n\u05e9\u05dc\u05d5\u05dd'),
(u'معرب', 'bottom', 2, u' \n\u0645\u0639\u0631\u0628'),
(u'test', 'middle', 3, u' \ntest\n '),
(Color(u'{blue}Test{/blue}'), 'middle', 3, u' \n\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + u'Test' + Fore.RESET, 'middle', 3, u' \n\x1b[34mTest\x1b[39m\n '),
(colored(u'Test', 'blue'), 'middle', 3, u' \n\x1b[34mTest\x1b[0m\n '),
(u'蓝色', 'middle', 3, u' \n蓝色\n '),
('test', 'middle', 3, ' \ntest\n '),
(Color('{blue}Test{/blue}'), 'middle', 3, ' \n\x1b[34mTest\x1b[39m\n '),
(Fore.BLUE + 'Test' + Fore.RESET, 'middle', 3, ' \n\x1b[34mTest\x1b[39m\n '),
(colored('Test', 'blue'), 'middle', 3, ' \n\x1b[34mTest\x1b[0m\n '),
('蓝色', 'middle', 3, ' \n蓝色\n '),
(u'שלום', 'middle', 3, u' \n\u05e9\u05dc\u05d5\u05dd\n '),
(u'معرب', 'middle', 3, u' \n\u0645\u0639\u0631\u0628\n '),
])
Expand All @@ -116,47 +116,47 @@ def test_height(string, align, height, expected):


@pytest.mark.parametrize('string,align,expected', [
(u'', '', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', '', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', '', u'.......\n.a.....\n.b.....\n.c.....\n.......'),
(u'test', '', u'.......\n.test..\n.......\n.......\n.......'),
(u'', 'left', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'left', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'left', u'.......\n.a.....\n.b.....\n.c.....\n.......'),
(u'test', 'left', u'.......\n.test..\n.......\n.......\n.......'),
(u'', 'right', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'right', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'right', u'.......\n.....a.\n.....b.\n.....c.\n.......'),
(u'test', 'right', u'.......\n..test.\n.......\n.......\n.......'),
(u'', 'center', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'center', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'center', u'.......\n...a...\n...b...\n...c...\n.......'),
(u'test', 'center', u'.......\n..test.\n.......\n.......\n.......'),
(u'', 'top', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'top', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'top', u'.......\n.a.....\n.b.....\n.c.....\n.......'),
(u'test', 'top', u'.......\n.test..\n.......\n.......\n.......'),
(u'', 'bottom', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'bottom', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'bottom', u'.......\n.a.....\n.b.....\n.c.....\n.......'),
(u'test', 'bottom', u'.......\n.......\n.......\n.test..\n.......'),
(u'', 'middle', u'.......\n.......\n.......\n.......\n.......'),
(u'\n', 'middle', u'.......\n.......\n.......\n.......\n.......'),
(u'a\nb\nc', 'middle', u'.......\n.a.....\n.b.....\n.c.....\n.......'),
(u'test', 'middle', u'.......\n.......\n.test..\n.......\n.......'),
('', '', '.......\n.......\n.......\n.......\n.......'),
('\n', '', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', '', '.......\n.a.....\n.b.....\n.c.....\n.......'),
('test', '', '.......\n.test..\n.......\n.......\n.......'),
('', 'left', '.......\n.......\n.......\n.......\n.......'),
('\n', 'left', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'left', '.......\n.a.....\n.b.....\n.c.....\n.......'),
('test', 'left', '.......\n.test..\n.......\n.......\n.......'),
('', 'right', '.......\n.......\n.......\n.......\n.......'),
('\n', 'right', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'right', '.......\n.....a.\n.....b.\n.....c.\n.......'),
('test', 'right', '.......\n..test.\n.......\n.......\n.......'),
('', 'center', '.......\n.......\n.......\n.......\n.......'),
('\n', 'center', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'center', '.......\n...a...\n...b...\n...c...\n.......'),
('test', 'center', '.......\n..test.\n.......\n.......\n.......'),
('', 'top', '.......\n.......\n.......\n.......\n.......'),
('\n', 'top', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'top', '.......\n.a.....\n.b.....\n.c.....\n.......'),
('test', 'top', '.......\n.test..\n.......\n.......\n.......'),
('', 'bottom', '.......\n.......\n.......\n.......\n.......'),
('\n', 'bottom', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'bottom', '.......\n.a.....\n.b.....\n.c.....\n.......'),
('test', 'bottom', '.......\n.......\n.......\n.test..\n.......'),
('', 'middle', '.......\n.......\n.......\n.......\n.......'),
('\n', 'middle', '.......\n.......\n.......\n.......\n.......'),
('a\nb\nc', 'middle', '.......\n.a.....\n.b.....\n.c.....\n.......'),
('test', 'middle', '.......\n.......\n.test..\n.......\n.......'),
(u'蓝色\nשלום\nمعرب', '', u'.......\n.蓝色..\n.\u05e9\u05dc\u05d5\u05dd..\n.\u0645\u0639\u0631\u0628..\n.......'),
('\n'.join((Color(u'{blue}Test{/blue}'), Fore.BLUE + u'Test' + Fore.RESET, colored(u'Test', 'blue'))), '',
u'.......\n.\x1b[34mTest\x1b[39m..\n.\x1b[34mTest\x1b[39m..\n.\x1b[34mTest\x1b[0m..\n.......'),
('\n'.join((Color('{blue}Test{/blue}'), Fore.BLUE + 'Test' + Fore.RESET, colored('Test', 'blue'))), '',
'.......\n.\x1b[34mTest\x1b[39m..\n.\x1b[34mTest\x1b[39m..\n.\x1b[34mTest\x1b[0m..\n.......'),
# (Color(u'{blue}A\nB{/blue}'), '', u'.......\n.\x1b[34mA\x1b[39m.....\n.\x1b[34mB\x1b[39m.....\n.......\n.......'),
# (Color('{blue}A\nB{/blue}'), '', '.......\n.\x1b[34mA\x1b[39m.....\n.\x1b[34mB\x1b[39m.....\n.......\n.......'),
])
def test_odd_width_height_pad_space(string, align, expected):
Expand Down

0 comments on commit 64ac27e

Please sign in to comment.