-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_suite.py
65 lines (44 loc) · 1.48 KB
/
test_suite.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/python
"""Tests for wind"""
import unittest
from wind.datastructures import FlexibleDeque, CaseInsensitiveDict
class StreamTestCase(unittest.TestCase):
"""Tests for modules in wind.stream"""
def setUp(self):
pass
def tearDown(self):
pass
def test_socket_read_bytes(self):
pass
class DatastructuresTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_flexible_deque_gather(self):
# Gather left
q = FlexibleDeque([b'y', b'-', b'combinator', b'...'])
q.gather(12)
assert q == FlexibleDeque([b'y-combinator', b'...'])
q.gather(13)
assert q == FlexibleDeque([b'y-combinator.', b'..'])
q.gather(30)
assert q == FlexibleDeque([b'y-combinator...'])
# Gather right
q = FlexibleDeque([b'Park', b' ', b'il', b'su', b'...'])
q.gather(9, left=False)
assert q == FlexibleDeque([b'Par', b'k ilsu...'])
q.gather(30, left=False)
assert q == FlexibleDeque([b'Park ilsu...'])
def test_caseinsensitive_dict(self):
# Test case-insensitive comparison.
dict_ = CaseInsensitiveDict()
dict_['club'] = 'octagon'
assert dict_.get('CLUB') == dict_.get('ClUb')
# Test `get` method works.
v = dict_.get('daft', 'punk')
assert v == 'punk'
v = dict_.get('CLub')
assert v == 'octagon'
if __name__ == '__main__':
unittest.main()