|
23 | 23 |
|
24 | 24 | import sys |
25 | 25 | import logging |
26 | | -import unittest |
27 | 26 |
|
28 | 27 | from .formatstring import fmtstr |
29 | 28 | from .formatstring import normalize_slice |
@@ -209,12 +208,10 @@ def __setitem__(self, slicetuple, value): |
209 | 208 | ] |
210 | 209 | + self.rows[rowslice.stop :] |
211 | 210 | ) |
212 | | - msg = ( |
213 | | - "You are trying to fit this value {} into the region {}: {}".format( |
214 | | - fmtstr("".join(value), bg="cyan"), |
215 | | - fmtstr("").join(grid_value), |
216 | | - "\n ".join(grid_fsarray[x] for x in range(len(self.rows))), |
217 | | - ) |
| 211 | + msg = "You are trying to fit this value {} into the region {}: {}".format( |
| 212 | + fmtstr("".join(value), bg="cyan"), |
| 213 | + fmtstr("").join(grid_value), |
| 214 | + "\n ".join(grid_fsarray[x] for x in range(len(self.rows))), |
218 | 215 | ) |
219 | 216 | raise ValueError( |
220 | 217 | """Error you are trying to replace a region of {} rows by {} |
@@ -300,43 +297,6 @@ def simple_format(x): |
300 | 297 | return "\n".join(actualize(l) for l in x) |
301 | 298 |
|
302 | 299 |
|
303 | | -class FormatStringTest(unittest.TestCase): |
304 | | - def assertFSArraysEqual(self, a, b): |
305 | | - # type: (FSArray, FSArray) -> None |
306 | | - self.assertEqual(type(a), FSArray) |
307 | | - self.assertEqual(type(b), FSArray) |
308 | | - self.assertEqual( |
309 | | - (a.width, b.height), |
310 | | - (a.width, b.height), |
311 | | - f"fsarray dimensions do not match: {a.shape} {b.shape}", |
312 | | - ) |
313 | | - for i, (a_row, b_row) in enumerate(zip(a, b)): |
314 | | - self.assertEqual( |
315 | | - a_row, |
316 | | - b_row, |
317 | | - "FSArrays differ first on line {}:\n{}".format(i, FSArray.diff(a, b)), |
318 | | - ) |
319 | | - |
320 | | - def assertFSArraysEqualIgnoringFormatting(self, a, b): |
321 | | - # type: (FSArray, FSArray) -> None |
322 | | - """Also accepts arrays of strings""" |
323 | | - self.assertEqual( |
324 | | - len(a), |
325 | | - len(b), |
326 | | - "fsarray heights do not match: %s %s \n%s \n%s" |
327 | | - % (len(a), len(b), simple_format(a), simple_format(b)), |
328 | | - ) |
329 | | - for i, (a_row, b_row) in enumerate(zip(a, b)): |
330 | | - a_row = a_row.s if isinstance(a_row, FmtStr) else a_row |
331 | | - b_row = b_row.s if isinstance(b_row, FmtStr) else b_row |
332 | | - self.assertEqual( |
333 | | - a_row, |
334 | | - b_row, |
335 | | - "FSArrays differ first on line %s:\n%s" |
336 | | - % (i, FSArray.diff(a, b, ignore_formatting=True)), |
337 | | - ) |
338 | | - |
339 | | - |
340 | 300 | if __name__ == "__main__": |
341 | 301 | a = FSArray(3, 14, bg="blue") |
342 | 302 | a[0:2, 5:11] = cast( |
|
0 commit comments