diff options
author | Lars Wirzenius <liw@liw.fi> | 2020-05-24 08:13:02 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2020-05-24 08:13:02 +0000 |
commit | 738c90cec0fd257334ec9e6e61314277286ea4e9 (patch) | |
tree | 0f09e6d77880b3673d6760e78642280d5de0c662 /templates/python/template.py | |
parent | 576aa3bcbb6615f4fef73264029fc22af78fdfdc (diff) | |
parent | f039dc7fcb3e9dd20166ecfe64d5428a812d5990 (diff) | |
download | subplot-738c90cec0fd257334ec9e6e61314277286ea4e9.tar.gz |
Merge branch 'kinnison/fix-52' into 'master'
Support JSON output in `sp-meta`
Closes #52
See merge request larswirzenius/subplot!45
Diffstat (limited to 'templates/python/template.py')
-rw-r--r-- | templates/python/template.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/templates/python/template.py b/templates/python/template.py index e430b1b..a1fa3ee 100644 --- a/templates/python/template.py +++ b/templates/python/template.py @@ -67,6 +67,20 @@ def assert_eq(a, b): def assert_ne(a, b): assert a != b, 'expected %r != %r' % (a, b) +# Check that two dict values are equal. +def assert_dict_eq(a, b): + assert isinstance(a, dict) + assert isinstance(b, dict) + for key in a: + assert key in b, f"exected {key} in both dicts" + av = a[key] + bv = b[key] + assert_eq(type(av), type(bv)) + if isinstance(av, list): + assert_eq(list(sorted(av)), list(sorted(bv))) + for key in b: + assert key in a, f"exected {key} in both dicts" + # Remember where we started from. The step functions may need to refer # to files there. srcdir = os.getcwd() |