aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-11-20 08:33:51 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-20 08:33:51 +0530
commitc5e3f84972f19e8f5c99ca358cf30bb105294e20 (patch)
treed66bd31948d0345b98125229b42eb5b0878669c8 /test
parentc45b87419f86b5c513a3135ea17e93b3deea6e29 (diff)
downloadhypervideo-pre-c5e3f84972f19e8f5c99ca358cf30bb105294e20.tar.lz
hypervideo-pre-c5e3f84972f19e8f5c99ca358cf30bb105294e20.tar.xz
hypervideo-pre-c5e3f84972f19e8f5c99ca358cf30bb105294e20.zip
[utils] Allow alignment in `render_table`
and add tests
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index 810ed3de4..b918ae2b6 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -1222,12 +1222,49 @@ ffmpeg version 2.4.4 Copyright (c) 2000-2014 the FFmpeg ...'''), '2.4.4')
def test_render_table(self):
self.assertEqual(
render_table(
+ ['a', 'empty', 'bcd'],
+ [[123, '', 4], [9999, '', 51]]),
+ 'a empty bcd\n'
+ '123 4\n'
+ '9999 51')
+
+ self.assertEqual(
+ render_table(
+ ['a', 'empty', 'bcd'],
+ [[123, '', 4], [9999, '', 51]],
+ hide_empty=True),
+ 'a bcd\n'
+ '123 4\n'
+ '9999 51')
+
+ self.assertEqual(
+ render_table(
+ ['\ta', 'bcd'],
+ [['1\t23', 4], ['\t9999', 51]]),
+ ' a bcd\n'
+ '1 23 4\n'
+ '9999 51')
+
+ self.assertEqual(
+ render_table(
['a', 'bcd'],
- [[123, 4], [9999, 51]]),
+ [[123, 4], [9999, 51]],
+ delim='-'),
'a bcd\n'
+ '--------\n'
'123 4\n'
'9999 51')
+ self.assertEqual(
+ render_table(
+ ['a', 'bcd'],
+ [[123, 4], [9999, 51]],
+ delim='-', extra_gap=2),
+ 'a bcd\n'
+ '----------\n'
+ '123 4\n'
+ '9999 51')
+
def test_match_str(self):
# Unary
self.assertFalse(match_str('xy', {'x': 1200}))