MCPcopy
hub / github.com/jtesta/ssh-audit / test_string

Method test_string

test/test_buffer.py:62–72  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

60 assert r(self._b(p[1])) == p[0]
61
62 def test_string(self):
63 w = lambda x: self.wbuf().write_string(x).write_flush() # noqa
64 r = lambda x: self.rbuf(x).read_string() # noqa
65 tc = [('abc1', '00 00 00 04 61 62 63 31'),
66 (b'abc2', '00 00 00 04 61 62 63 32')]
67 for p in tc:
68 v = p[0]
69 assert w(v) == self._b(p[1])
70 if not isinstance(v, bytes):
71 v = bytes(bytearray(v, 'utf-8'))
72 assert r(self._b(p[1])) == v
73
74 def test_list(self):
75 w = lambda x: self.wbuf().write_list(x).write_flush() # noqa

Callers

nothing calls this directly

Calls 4

_bMethod · 0.95
write_flushMethod · 0.80
write_stringMethod · 0.80
read_stringMethod · 0.80

Tested by

no test coverage detected