testutil: Improve check_post_meta error reporting.
This version makes it easier to get diffs between the expected and actual metadata.
This commit is contained in:
parent
cbd94d9b75
commit
f1c115de49
1 changed files with 4 additions and 2 deletions
|
@ -33,8 +33,10 @@ def check_post_meta(txn, *expected_meta, default=None):
|
||||||
if not expected:
|
if not expected:
|
||||||
assert not post.meta
|
assert not post.meta
|
||||||
else:
|
else:
|
||||||
assert all(post.meta.get(key, default) == value
|
actual = None if post.meta is None else {
|
||||||
for key, value in expected.items())
|
key: post.meta.get(key, default) for key in expected
|
||||||
|
}
|
||||||
|
assert actual == expected
|
||||||
|
|
||||||
def parse_date(s, fmt='%Y-%m-%d'):
|
def parse_date(s, fmt='%Y-%m-%d'):
|
||||||
return datetime.datetime.strptime(s, fmt).date()
|
return datetime.datetime.strptime(s, fmt).date()
|
||||||
|
|
Loading…
Reference in a new issue