forked from ojii/clint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_clint.py
executable file
·46 lines (32 loc) · 1.1 KB
/
test_clint.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Clint Test Suite."""
import unittest
class TablibTestCase(unittest.TestCase):
"""Tablib test cases."""
def setUp(self):
import clint
def tearDown(self):
pass
class ColoredStringTestCase(unittest.TestCase):
def setUp(self):
from clint.textui.colored import ColoredString
def tearDown(self):
pass
def test_split(self):
from clint.textui.colored import ColoredString
new_str = ColoredString('red', "hello world")
output = new_str.split()
assert output[0].s == "hello"
def test_find(self):
from clint.textui.colored import ColoredString
new_str = ColoredString('blue', "hello world")
output = new_str.find('h')
self.assertEqual(output, 0)
def test_replace(self):
from clint.textui.colored import ColoredString
new_str = ColoredString('green', "hello world")
output = new_str.replace("world", "universe")
assert output.s == "hello universe"
if __name__ == '__main__':
unittest.main()