| @@ -1,6 +1,7 @@ | |||||
| import base64 | import base64 | ||||
| import copy | import copy | ||||
| import datetime | import datetime | ||||
| import functools | |||||
| import itertools | import itertools | ||||
| import json | import json | ||||
| import unittest | import unittest | ||||
| @@ -31,6 +32,7 @@ class _TestJSONEncoder(unittest.TestCase): | |||||
| # XXX - add validation | # XXX - add validation | ||||
| # XXX - how to add singletons | # XXX - how to add singletons | ||||
| @functools.total_ordering | |||||
| class MDBase(object): | class MDBase(object): | ||||
| '''This is a simple wrapper that turns a JSON object into a pythonesc | '''This is a simple wrapper that turns a JSON object into a pythonesc | ||||
| object where attribute accesses work.''' | object where attribute accesses work.''' | ||||
| @@ -170,6 +172,10 @@ class MDBase(object): | |||||
| return self._obj | return self._obj | ||||
| def __lt__(self, o): | |||||
| return (self['type'], self['uuid'], self['modified']) < \ | |||||
| (o['type'], o['uuid'], o['modified']) | |||||
| def __eq__(self, o): | def __eq__(self, o): | ||||
| return self._obj == o | return self._obj == o | ||||