Esempio n. 1
0
    def test_len_of_unicode_in_fsarray(self):

        fsa = FSArray(3, 2)
        fsa.rows[0] = fsa.rows[0].setslice_with_length(0, 2, '┌─', 2)
        self.assertEqual(fsa.shape, (3, 2))
        fsa.rows[0] = fsa.rows[0].setslice_with_length(0, 2, fmtstr('┌─', 'blue'), 2)
        self.assertEqual(fsa.shape, (3, 2))
Esempio n. 2
0
    def test_len_of_unicode_in_fsarray(self):

        fsa = FSArray(3, 2)
        fsa.rows[0] = fsa.rows[0].setslice_with_length(0, 2, '┌─', 2)
        self.assertEqual(fsa.shape, (3, 2))
        fsa.rows[0] = fsa.rows[0].setslice_with_length(0, 2, fmtstr('┌─', 'blue'), 2)
        self.assertEqual(fsa.shape, (3, 2))
Esempio n. 3
0
 def assertFSArraysEqual(self, a, b):
     # type: (FSArray, FSArray) -> None
     self.assertIsInstance(a, FSArray)
     self.assertIsInstance(b, FSArray)
     self.assertEqual(
         (a.width, b.height),
         (a.width, b.height),
         f"fsarray dimensions do not match: {a.shape} {b.shape}",
     )
     for i, (a_row, b_row) in enumerate(zip(a, b)):
         self.assertEqual(
             a_row,
             b_row,
             "FSArrays differ first on line {}:\n{}".format(
                 i, FSArray.diff(a, b)),
         )
Esempio n. 4
0
 def assertFSArraysEqualIgnoringFormatting(self, a, b):
     # type: (FSArray, FSArray) -> None
     """Also accepts arrays of strings"""
     self.assertEqual(
         len(a),
         len(b),
         "fsarray heights do not match: %s %s \n%s \n%s" %
         (len(a), len(b), simple_format(a), simple_format(b)),
     )
     for i, (a_row, b_row) in enumerate(zip(a, b)):
         a_row = a_row.s if isinstance(a_row, FmtStr) else a_row
         b_row = b_row.s if isinstance(b_row, FmtStr) else b_row
         self.assertEqual(
             a_row,
             b_row,
             "FSArrays differ first on line %s:\n%s" %
             (i, FSArray.diff(a, b, ignore_formatting=True)),
         )
Esempio n. 5
0
 def test_oomerror(self):
     a = FSArray(10, 40)
     a[2:-2, 2:-2] = fsarray(['asdf', 'zxcv'])
Esempio n. 6
0
 def test_assignment_working(self):
     t = FSArray(10, 10)
     t[2, 2] = 'a'
     t[2, 2] == 'a'
Esempio n. 7
0
 def test_no_hanging_space(self):
     a = FSArray(4, 2)
     self.assertEqual(len(a.rows[0]), 0)
Esempio n. 8
0
 def test_oomerror(self):
     a = FSArray(10, 40)
     a[2:-2, 2:-2] = fsarray(["asdf", "zxcv"])