MCPcopy Index your code
hub / github.com/python/cpython / test_storlines

Method test_storlines

Lib/test/test_ftplib.py:633–648  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

631 self.assertEqual(self.server.handler_instance.rest, str(r))
632
633 def test_storlines(self):
634 data = RETR_DATA.replace('\r\n', '\n').encode(self.client.encoding)
635 f = io.BytesIO(data)
636 self.client.storlines('stor', f)
637 self.check_data(self.server.handler_instance.last_received_data,
638 RETR_DATA.encode(self.server.encoding))
639 # test new callback arg
640 flag = []
641 f.seek(0)
642 self.client.storlines('stor foo', f, callback=lambda x: flag.append(None))
643 self.assertTrue(flag)
644
645 f = io.StringIO(RETR_DATA.replace('\r\n', '\n'))
646 # storlines() expects a binary file, not a text file
647 with warnings_helper.check_warnings(('', BytesWarning), quiet=True):
648 self.assertRaises(TypeError, self.client.storlines, 'stor foo', f)
649
650 def test_nlst(self):
651 self.client.nlst()

Callers

nothing calls this directly

Calls 8

check_dataMethod · 0.95
storlinesMethod · 0.80
assertTrueMethod · 0.80
encodeMethod · 0.45
replaceMethod · 0.45
seekMethod · 0.45
appendMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected