Files
clint/test_clint.py
T
jczetta b69ceb18d2 redefined __getattr__ so all str methods work
All str methods work for ColoredStrings with expected functionality, excepting .join(). Retained some other method definitions in order to retain expected functionality. Added tests for ColoredString.
2012-08-25 12:43:29 -04:00

47 lines
1.1 KiB
Python
Executable File

#!/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()