Exemplo n.º 1
0
 def test_indent(self):
     """ Colr.indent should indent a char, str, or Colr. """
     colrnames = ('red', 'blue', 'black', 'white')
     for i, name in enumerate(colrnames):
         n = (i + 1) * 2
         clr = Colr('test', name)
         clr2 = clr.copy()
         self.assertCallEqual(
             clr.indent(n, char=' '),
             Colr('{}{}'.format(' ' * n, clr2)),
             func=Colr.indent,
             args=(n, ' '),
             msg='Failed to indent properly.',
         )
Exemplo n.º 2
0
 def test_append(self):
     """ Colr.append should append a char, str, or Colr. """
     colrnames = ('red', 'blue', 'black', 'white')
     for i, name in enumerate(colrnames):
         n = (i + 1) * 2
         clr = Colr('test', name)
         clr2 = clr.copy()
         self.assertCallEqual(
             clr.append(' ', length=n),
             Colr('{}{}'.format(clr2, ' ' * n)),
             func=Colr.append,
             args=(' ', n),
             msg='Failed to append properly.',
         )
Exemplo n.º 3
0
 def test_copy(self):
     """ Colr.copy() should return the same data with the same class. """
     colrnames = ('red', 'white', 'blue', 'black')
     for name in colrnames:
         clr1 = Colr('test', name)
         clr2 = clr1.copy()
         self.assertCallEqual(
             clr1,
             clr2,
             func=Colr.copy,
             msg='Copy was not equal!',
         )
         self.assertCallEqual(
             clr1.data,
             clr2.data,
             func=Colr.copy,
             msg='Copy data was not equal!',
         )
         self.assertCallEqual(
             hash(clr1),
             hash(clr2),
             func=Colr.copy,
             msg='Copy hash was not equal!',
         )