Skip to content

Instantly share code, notes, and snippets.

View MrCreosote's full-sized avatar

MrCreosote

  • Lawrence Berkeley National Laboratory
View GitHub Profile
import datetime, time, functools, operator, types
default_fudge = datetime.timedelta(seconds=0, microseconds=0, days=0)
def deep_eq(_v1, _v2, datetime_fudge=default_fudge, _assert=False):
"""
Tests for deep equality between two python data structures recursing
into sub-structures if necessary. Works with all python types including
iterators and generators. This function was dreampt up to test API responses
but could be used for anything. Be careful. With deeply nested structures