MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_write_and_rewind

Method test_write_and_rewind

Lib/test/test_io.py:1997–2008  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1995 self.assertStartsWith(s, b"01234567A")
1996
1997 def test_write_and_rewind(self):
1998 raw = self.BytesIO()
1999 bufio = self.tp(raw, 4)
2000 self.assertEqual(bufio.write(b"abcdef"), 6)
2001 self.assertEqual(bufio.tell(), 6)
2002 bufio.seek(0, 0)
2003 self.assertEqual(bufio.write(b"XY"), 2)
2004 bufio.seek(6, 0)
2005 self.assertEqual(raw.getvalue(), b"XYcdef")
2006 self.assertEqual(bufio.write(b"123456"), 6)
2007 bufio.flush()
2008 self.assertEqual(raw.getvalue(), b"XYcdef123456")
2009
2010 def test_flush(self):
2011 writer = self.MockRawIO()

Callers

nothing calls this directly

Calls 6

getvalueMethod · 0.95
assertEqualMethod · 0.45
writeMethod · 0.45
tellMethod · 0.45
seekMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected