in case we do not have SimpleNamespace

This commit is contained in:
Martin A. Brown 2016-02-13 11:24:54 -08:00
parent eaf2823fd6
commit d16d10f405
1 changed files with 16 additions and 0 deletions

16
tests/utils.py Normal file
View File

@ -0,0 +1,16 @@
from __future__ import absolute_import, division, print_function
class SimpleNamespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
def __repr__(self):
keys = sorted(self.__dict__)
items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
return "{}({})".format(type(self).__name__, ", ".join(items))
def __eq__(self, other):
return self.__dict__ == other.__dict__