How to use the jsondiff.Comparer function in jsondiff

To help you get started, we’ve selected a few jsondiff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apitrace / apitrace / scripts / View on Github external
def verify(apitrace, inTrace, inCallNo, outTrace, outCallNo):
    inState = getState(apitrace, inTrace, inCallNo)
    outState = getState(apitrace, outTrace, outCallNo)

    comparer = jsondiff.Comparer(ignore_added = True)
    match = comparer.visit(inState, outState)
    if match:
        sys.stdout.write("States match.\n")
        sys.stdout.write("States do not match.\n")
        differ = Differ(sys.stdout)
        differ.visit(inState, outState)