Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(9544)

Unified Diff: Lib/test/test_telnetlib.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_sys.py ('k') | Lib/test/test_tempfile.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/test_telnetlib.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/test_telnetlib.py Fri Feb 07 23:40:05 2014 +0200
@@ -43,7 +43,7 @@
telnet.sock.close()
def testTimeoutDefault(self):
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
socket.setdefaulttimeout(30)
try:
telnet = telnetlib.Telnet(HOST, self.port)
@@ -54,13 +54,13 @@
def testTimeoutNone(self):
# None, having other default
- self.assertTrue(socket.getdefaulttimeout() is None)
+ self.assertIsNone(socket.getdefaulttimeout())
socket.setdefaulttimeout(30)
try:
telnet = telnetlib.Telnet(HOST, self.port, timeout=None)
finally:
socket.setdefaulttimeout(None)
- self.assertTrue(telnet.sock.gettimeout() is None)
+ self.assertIsNone(telnet.sock.gettimeout())
telnet.sock.close()
def testTimeoutValue(self):
@@ -210,7 +210,7 @@
# test 'at least one byte'
telnet = test_telnet([b'x' * 500])
data = telnet.read_some()
- self.assertTrue(len(data) >= 1)
+ self.assertGreaterEqual(len(data), 1)
# test EOF
telnet = test_telnet()
data = telnet.read_some()
@@ -312,7 +312,7 @@
telnet.set_option_negotiation_callback(nego.do_nego)
txt = telnet.read_all()
cmd = nego.seen
- self.assertTrue(len(cmd) > 0) # we expect at least one command
+ self.assertGreater(len(cmd), 0) # we expect at least one command
self.assertIn(cmd[:1], self.cmds)
self.assertEqual(cmd[1:2], tl.NOOPT)
self.assertEqual(data_len, len(txt + cmd))
« no previous file with comments | « Lib/test/test_sys.py ('k') | Lib/test/test_tempfile.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+