termstr: Coding style.
- Add tests for xterm_colors and closest_color_index.
This commit is contained in:
parent
2b5d14b87d
commit
33616d3f37
1 changed files with 17 additions and 0 deletions
|
|
@ -10,6 +10,23 @@ import fill3.terminal as terminal
|
|||
import termstr
|
||||
|
||||
|
||||
class XtermColorsTests(unittest.TestCase):
|
||||
|
||||
def test_xterm_colors(self):
|
||||
self.assertEqual(len(termstr.XTERM_COLORS), 256)
|
||||
self.assertEqual(termstr.XTERM_COLORS[0], (0, 0, 0))
|
||||
self.assertEqual(termstr.XTERM_COLORS[100], (135, 135, 0))
|
||||
self.assertEqual(termstr.XTERM_COLORS[255], (238, 238, 238))
|
||||
|
||||
def test_closest_color_index(self):
|
||||
self.assertEqual(termstr.closest_color_index(
|
||||
(0, 0, 0), termstr.XTERM_COLORS), 0)
|
||||
self.assertEqual(termstr.closest_color_index(
|
||||
(255, 255, 255), termstr.XTERM_COLORS), 15)
|
||||
self.assertEqual(termstr.closest_color_index(
|
||||
(135, 135, 1), termstr.XTERM_COLORS), 100)
|
||||
|
||||
|
||||
class CharStyleTests(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue