|
def | __call__ (self, ref, out, result, detailed=True) |
|
Definition at line 1542 of file BaseTest.py.
◆ __call__()
def GaudiTesting.BaseTest.JSONOutputValidator.__call__ |
( |
|
self, |
|
|
|
ref, |
|
|
|
out, |
|
|
|
result, |
|
|
|
detailed = True |
|
) |
| |
Validate JSON output.
returns -- A list of strings giving causes of failure.
Definition at line 1543 of file BaseTest.py.
1543 def __call__(self, ref, out, result, detailed=True):
1544 """Validate JSON output.
1545 returns -- A list of strings giving causes of failure."""
1549 with open(ref)
as f:
1550 expected = json.load(f)
1551 except json.JSONDecodeError
as err:
1552 causes.append(
"json parser error")
1553 result[
"reference_parse_error"] = f
"json parser error in {ref}: {err}"
1558 causes.append(
"json content")
1559 result[
"json_diff"] =
"detailed diff was turned off"
1567 expected = sorted(expected, key=
lambda item: (item[
"component"], item[
"name"]))
1568 out = sorted(out, key=
lambda item: (item[
"component"], item[
"name"]))
1570 t.assertEqual(expected, out)
1571 except AssertionError
as err:
1572 causes.append(
"json content")
1573 result[
"json_diff"] = str(err).splitlines()[0]
The documentation for this class was generated from the following file: