This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/incubator-ponymail-unit-tests.git
The following commit(s) were added to refs/heads/master by this push:
new ca2a06b Simplify
ca2a06b is described below
commit ca2a06b19ed39c880747da4adfb3c0c288685189
Author: Sebb <[email protected]>
AuthorDate: Sat Aug 15 17:20:08 2020 +0100
Simplify
---
tests/test-generators.py | 12 ++++--------
tests/test-parsing.py | 12 ++++--------
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/tests/test-generators.py b/tests/test-generators.py
index 2c7847e..19a88ec 100644
--- a/tests/test-generators.py
+++ b/tests/test-generators.py
@@ -46,10 +46,8 @@ def generate_specs(args):
json, _, _, _ = archie.compute_updates(fake_args, lid, False,
message, message_raw)
# PM <= 0.12 parameters
else:
- try:
- json, _, _, _ = archie.compute_updates(lid, False, message)
- except ValueError: # PM <= 0.10 only 2 return values
- json, _ = archie.compute_updates(lid, False, message)
+ # May return 2 or 4 values; only want first
+ json = archie.compute_updates(lid, False, message)[0]
gen_spec.append({
'index': key,
'message-id': message.get('message-id').strip(),
@@ -104,10 +102,8 @@ def run_tests(args):
json, _, _, _ = archie.compute_updates(fake_args, lid,
False, message)
# PM <= 0.11 parameters (missing args)
else:
- try:
- json, _, _, _ = archie.compute_updates(lid, False,
message)
- except ValueError: # PM <= 0.10 only 2 return values
- json, _ = archie.compute_updates(lid, False, message)
+ # May return 2 or 4 values; only want first
+ json = archie.compute_updates(lid, False, message)[0]
if json['mid'] != test['generated']:
errors += 1
diff --git a/tests/test-parsing.py b/tests/test-parsing.py
index 5f57c44..73d36fe 100644
--- a/tests/test-parsing.py
+++ b/tests/test-parsing.py
@@ -42,10 +42,8 @@ def generate_specs(args):
json, _, _, _ = archie.compute_updates(fake_args, lid, False,
message)
# PM <= 0.11 parameters (missing args)
else:
- try:
- json, _, _, _ = archie.compute_updates(lid, False, message)
- except ValueError: # PM <= 0.10 only 2 return values
- json, _ = archie.compute_updates(lid, False, message)
+ # May return 2 or 4 values; only want first
+ json = archie.compute_updates(lid, False, message)[0]
body_sha3_256 = None
if json and json.get('body') is not None:
body_sha3_256 =
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()
@@ -95,10 +93,8 @@ def run_tests(args):
json, _, _, _ = archie.compute_updates(fake_args, lid, False,
message)
# PM <= 0.11 parameters (missing args)
else:
- try:
- json, _, _, _ = archie.compute_updates(lid, False, message)
- except ValueError: # PM <= 0.10 only 2 return values
- json, _ = archie.compute_updates(lid, False, message)
+ # May return 2 or 4 values; only want first
+ json = archie.compute_updates(lid, False, message)[0]
body_sha3_256 = None
if json and json.get('body') is not None:
body_sha3_256 =
hashlib.sha3_256(json['body'].encode('utf-8')).hexdigest()