-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_test.py
More file actions
40 lines (27 loc) · 1008 Bytes
/
Copy pathutil_test.py
File metadata and controls
40 lines (27 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Tests for util.py"""
import unittest
import util
__author__ = 'dan.barella@gmail.com (Dan Barella)'
class TestPad(unittest.TestCase):
def test_empty_field(self):
"""Test padding an empty field."""
self.assertFalse(util.pad([], None))
def test_single_entry(self):
"""Test padding a field with one entry."""
field = [['a']]
actual_result = util.pad(field, None)
expected_result = [[None, None, None],
[None, 'a', None],
[None, None, None]]
self.assertEqual(expected_result, actual_result)
def test_jagged_field(self):
"""Test padding a jagged field."""
field = [['a'], ['b', 'c']]
actual_result = util.pad(field, None)
expected_result = [[None, None, None],
[None, 'a', None],
[None, 'b', 'c', None],
[None, None, None, None]]
self.assertEqual(expected_result, actual_result)
if __name__ == '__main__':
unittest.main()