From 3fa644b35b7820ab28a53f60d89cb7a6b92ee168 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 19 Jan 2022 11:43:51 +0000 Subject: [PATCH] remove two more assert statements with side-effects - these were overlooked in e7d531db0 - scripts now run with PYTHONOPTIMIZE=1, though this should never be set in a production environment --- mmgen/addrfile.py | 3 ++- test/misc/oneshot_warning.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mmgen/addrfile.py b/mmgen/addrfile.py index e530fa44..7410be7b 100755 --- a/mmgen/addrfile.py +++ b/mmgen/addrfile.py @@ -230,7 +230,8 @@ class AddrFile(MMGenObject): assert len(lines) >= 3, f'Too few lines in address file ({len(lines)})' ls = lines[0].split() assert 1 < len(ls) < 5, f'Invalid first line for {p.gen_desc} file: {lines[0]!r}' - assert ls.pop() == '{', f'{ls!r}: invalid first line' + assert ls[-1] == '{', f'{ls!r}: invalid first line' + ls.pop() assert lines[-1] == '}', f'{lines[-1]!r}: invalid last line' sid = ls.pop(0) assert is_seed_id(sid), f'{sid!r}: invalid Seed ID' diff --git a/test/misc/oneshot_warning.py b/test/misc/oneshot_warning.py index 26e0ba57..a2365d5b 100755 --- a/test/misc/oneshot_warning.py +++ b/test/misc/oneshot_warning.py @@ -32,7 +32,8 @@ for i in (1,2,3): msg('\npw') for k in ('A','B'): - assert pwfile_reuse_warning(k).warning_shown == (i != 1), 'warning_shown incorrect' + ret = pwfile_reuse_warning(k).warning_shown + assert ret == (i != 1), 'warning_shown incorrect' msg('wg1') wg('foo')