Shorten str type checks
diff --git a/OpenSSL/rand.py b/OpenSSL/rand.py
index 1f628e8..311c00b 100644
--- a/OpenSSL/rand.py
+++ b/OpenSSL/rand.py
@@ -136,7 +136,7 @@
to read the entire file
:return: The number of bytes read
"""
- if not isinstance(filename, str) and not isinstance(filename, _builtin_bytes):
+ if not isinstance(filename, (str, _builtin_bytes)):
raise TypeError("filename must be a string")
if maxbytes is _unspecified:
@@ -155,7 +155,7 @@
:param filename: The file to write data to
:return: The number of bytes written
"""
- if not isinstance(filename, str) and not isinstance(filename, _builtin_bytes):
+ if not isinstance(filename, (str, _builtin_bytes)):
raise TypeError("filename must be a string")
return _lib.RAND_write_file(filename)
diff --git a/OpenSSL/test/test_rand.py b/OpenSSL/test/test_rand.py
index c52cb6b..fbb452c 100644
--- a/OpenSSL/test/test_rand.py
+++ b/OpenSSL/test/test_rand.py
@@ -176,7 +176,6 @@
self.assertRaises(TypeError, rand.write_file, None)
self.assertRaises(TypeError, rand.write_file, "foo", None)
-
def test_files(self):
"""
Test reading and writing of files via rand functions.