

def _assert_fields_equal(self, a, b, exclude=None):
    exclude = (exclude or [])
    fields = {k: v for (k, v) in six.iteritems(self.db_type._fields) if (k not in exclude)}
    assert_funcs = {
        'mongoengine.fields.DictField': self.assertDictEqual,
        'mongoengine.fields.ListField': self.assertListEqual,
        'mongoengine.fields.SortedListField': self.assertListEqual,
    }
    for (k, v) in six.iteritems(fields):
        assert_func = assert_funcs.get(str(v), self.assertEqual)
        assert_func(getattr(a, k, None), getattr(b, k, None))

dataset/ETHPy150Open StackStorm/st2/st2tests/st2tests/base.py DbModelTestCase._assert_fields_equal/original