4
4
import sys
5
5
6
6
from contextlib import contextmanager
7
- from curtsies .formatstringarray import FormatStringTest , fsarray
7
+ from curtsies .formatstringarray import (
8
+ fsarray ,
9
+ assertFSArraysEqual ,
10
+ assertFSArraysEqualIgnoringFormatting ,
11
+ )
8
12
from curtsies .fmtfuncs import cyan , bold , green , yellow , on_magenta , red
9
13
from unittest import mock
10
14
@@ -41,7 +45,7 @@ def tearDownClass(cls):
41
45
TestCase .tearDownClass ()
42
46
43
47
44
- class CurtsiesPaintingTest (FormatStringTest , ClearEnviron ):
48
+ class CurtsiesPaintingTest (ClearEnviron ):
45
49
def setUp (self ):
46
50
class TestRepl (BaseRepl ):
47
51
def _request_refresh (inner_self ):
@@ -56,14 +60,14 @@ def locals(self):
56
60
57
61
def assert_paint (self , screen , cursor_row_col ):
58
62
array , cursor_pos = self .repl .paint ()
59
- self . assertFSArraysEqual (array , screen )
63
+ assertFSArraysEqual (array , screen )
60
64
self .assertEqual (cursor_pos , cursor_row_col )
61
65
62
66
def assert_paint_ignoring_formatting (
63
67
self , screen , cursor_row_col = None , ** paint_kwargs
64
68
):
65
69
array , cursor_pos = self .repl .paint (** paint_kwargs )
66
- self . assertFSArraysEqualIgnoringFormatting (array , screen )
70
+ assertFSArraysEqualIgnoringFormatting (array , screen )
67
71
if cursor_row_col is not None :
68
72
self .assertEqual (cursor_pos , cursor_row_col )
69
73
@@ -156,7 +160,7 @@ def foo(x, y, z=10):
156
160
+ bold (cyan ("10" ))
157
161
+ yellow (")" )
158
162
]
159
- self . assertFSArraysEqual (fsarray (array ), fsarray (screen ))
163
+ assertFSArraysEqual (fsarray (array ), fsarray (screen ))
160
164
161
165
def test_formatted_docstring (self ):
162
166
actual = replpainter .formatted_docstring (
@@ -165,7 +169,7 @@ def test_formatted_docstring(self):
165
169
config = setup_config (),
166
170
)
167
171
expected = fsarray (["Returns the results" , "" , "Also has side effects" ])
168
- self . assertFSArraysEqualIgnoringFormatting (actual , expected )
172
+ assertFSArraysEqualIgnoringFormatting (actual , expected )
169
173
170
174
def test_unicode_docstrings (self ):
171
175
"A bit of a special case in Python 2"
@@ -178,7 +182,7 @@ def foo():
178
182
foo .__doc__ , 40 , config = setup_config ()
179
183
)
180
184
expected = fsarray (["åß∂ƒ" ])
181
- self . assertFSArraysEqualIgnoringFormatting (actual , expected )
185
+ assertFSArraysEqualIgnoringFormatting (actual , expected )
182
186
183
187
def test_nonsense_docstrings (self ):
184
188
for docstring in [
@@ -208,7 +212,7 @@ def foo():
208
212
wd = pydoc .getdoc (foo )
209
213
actual = replpainter .formatted_docstring (wd , 40 , config = setup_config ())
210
214
expected = fsarray (["asdfåß∂ƒ" ])
211
- self . assertFSArraysEqualIgnoringFormatting (actual , expected )
215
+ assertFSArraysEqualIgnoringFormatting (actual , expected )
212
216
213
217
def test_paint_lasts_events (self ):
214
218
actual = replpainter .paint_last_events (
@@ -219,7 +223,7 @@ def test_paint_lasts_events(self):
219
223
else :
220
224
expected = fsarray (["+-+" , "|c|" , "|b|" , "+-+" ])
221
225
222
- self . assertFSArraysEqualIgnoringFormatting (actual , expected )
226
+ assertFSArraysEqualIgnoringFormatting (actual , expected )
223
227
224
228
225
229
@contextmanager
0 commit comments