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

Method test_421_from_data_cmd

Lib/test/test_smtplib.py:1321–1335  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1319 self.assertDictEqual(r.exception.args[0], {'Frank': (421, b'closing')})
1320
1321 def test_421_from_data_cmd(self):
1322 class MySimSMTPChannel(SimSMTPChannel):
1323 def found_terminator(self):
1324 if self.smtp_state == self.DATA:
1325 self.push('421 closing')
1326 else:
1327 super().found_terminator()
1328 self.serv.channel_class = MySimSMTPChannel
1329 smtp = smtplib.SMTP(HOST, self.port, local_hostname='localhost',
1330 timeout=support.LOOPBACK_TIMEOUT)
1331 smtp.noop()
1332 with self.assertRaises(smtplib.SMTPDataError):
1333 smtp.sendmail('John@foo.org', ['Sally@foo.org'], 'test message')
1334 self.assertIsNone(smtp.sock)
1335 self.assertEqual(self.serv._SMTPchannel.rcpt_count, 0)
1336
1337 def test_smtputf8_NotSupportedError_if_no_server_support(self):
1338 smtp = smtplib.SMTP(

Callers

nothing calls this directly

Calls 5

noopMethod · 0.95
sendmailMethod · 0.95
assertIsNoneMethod · 0.80
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected