diff options
author | JinWang An <jinwang.an@samsung.com> | 2021-12-01 16:54:37 +0900 |
---|---|---|
committer | JinWang An <jinwang.an@samsung.com> | 2021-12-01 16:54:37 +0900 |
commit | 56c3832bc03cffe24fcca71370b668a6678d0cf9 (patch) | |
tree | 7d2ccfe8d9c60dbb012bb62d7fcd6820db56dc61 /lang/python/tests/t-idiomatic.py | |
parent | 398648eddb70bc844e1bc5996521e87dea3188e9 (diff) | |
download | gpgme-upstream/1.12.0.tar.gz gpgme-upstream/1.12.0.tar.bz2 gpgme-upstream/1.12.0.zip |
Imported Upstream version 1.12.0upstream/1.12.0
Diffstat (limited to 'lang/python/tests/t-idiomatic.py')
-rwxr-xr-x | lang/python/tests/t-idiomatic.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lang/python/tests/t-idiomatic.py b/lang/python/tests/t-idiomatic.py index b7ae4eb..238bbf3 100755 --- a/lang/python/tests/t-idiomatic.py +++ b/lang/python/tests/t-idiomatic.py @@ -18,7 +18,6 @@ # License along with this program; if not, see <http://www.gnu.org/licenses/>. from __future__ import absolute_import, print_function, unicode_literals -del absolute_import, print_function, unicode_literals import sys import io @@ -26,7 +25,9 @@ import os import tempfile import gpg import support -_ = support # to appease pyflakes. +_ = support # to appease pyflakes. + +del absolute_import, print_function, unicode_literals # Both Context and Data can be used as context manager: with gpg.Context() as c, gpg.Data() as d: @@ -34,8 +35,9 @@ with gpg.Context() as c, gpg.Data() as d: d.write(b"Halloechen") leak_c = c leak_d = d -assert leak_c.wrapped == None -assert leak_d.wrapped == None +assert leak_c.wrapped is None +assert leak_d.wrapped is None + def sign_and_verify(source, signed, sink): with gpg.Context() as c: @@ -53,6 +55,7 @@ def sign_and_verify(source, signed, sink): sink.seek(0, os.SEEK_SET) assert sink.read() == b"Hallo Leute\n" + # Demonstrate automatic wrapping of file-like objects with 'fileno' # method. with tempfile.TemporaryFile() as source, \ @@ -73,7 +76,7 @@ if sys.version_info[0] == 3: bio.truncate(1) if len(bio.getvalue()) != 1: # This version of Python is affected, preallocate buffer. - preallocate = 128*b'\x00' + preallocate = 128 * b'\x00' else: preallocate = b'' |