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:
|
||||
assert not post.meta
|
||||
else:
|
||||
assert all(post.meta.get(key, default) == value
|
||||
for key, value in expected.items())
|
||||
actual = None if post.meta is None else {
|
||||
key: post.meta.get(key, default) for key in expected
|
||||
}
|
||||
assert actual == expected
|
||||
|
||||
def parse_date(s, fmt='%Y-%m-%d'):
|
||||
return datetime.datetime.strptime(s, fmt).date()
|
||||
|
|
Loading…
Reference in a new issue