MCPcopy Index your code
hub / github.com/bpython/bpython / assertAccess

Method assertAccess

bpython/test/test_line_properties.py:81–106  ·  view source on GitHub ↗

r"""Asserts that self.func matches as described by s, which uses a little language to describe matches: abcd hijklmnopqrstuvwx|yz /|\ /|\ /|\ | | | the function should the current cursor position match th

(self, s)

Source from the content-addressed store, hash-verified

79
80class LineTestCase(unittest.TestCase):
81 def assertAccess(self, s):
82 r"""Asserts that self.func matches as described
83 by s, which uses a little language to describe matches:
84
85 abcd<efg>hijklmnopqrstuvwx|yz
86 /|\ /|\ /|\
87 | | |
88 the function should the current cursor position
89 match this "efg" is between the x and y
90 """
91 (cursor_offset, line), match = decode(s)
92 result = self.func(cursor_offset, line)
93
94 self.assertEqual(
95 result,
96 match,
97 "%s(%r) result\n%r (%r) doesn't match expected\n%r (%r)"
98 % (
99 self.func.__name__,
100 line_with_cursor(cursor_offset, line),
101 encode(cursor_offset, line, result),
102 result,
103 s,
104 match,
105 ),
106 )
107
108
109class TestHelpers(LineTestCase):

Callers 15

test_assert_accessMethod · 0.80
test_simpleMethod · 0.80
test_insideMethod · 0.80
test_dotsMethod · 0.80
test_non_dotsMethod · 0.80
test_open_parenMethod · 0.80
test_simpleMethod · 0.80
test_simpleMethod · 0.80
test_closedMethod · 0.80
test_openMethod · 0.80
test_simpleMethod · 0.80
test_simpleMethod · 0.80

Calls 4

decodeFunction · 0.85
line_with_cursorFunction · 0.85
encodeFunction · 0.85
funcMethod · 0.80

Tested by

no test coverage detected