add eq for python, update test case

This commit is contained in:
wing328
2015-11-24 17:36:38 +08:00
parent 34a021cdb5
commit b592819e3b
9 changed files with 147 additions and 1 deletions

View File

@@ -113,5 +113,18 @@ class {{classname}}(object):
For `print` and `pprint`
"""
return self.to_str()
def __eq__(self, other):
"""
Returns true if both objects are equal
"""
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""
Returns true if both objects are not equal
"""
return not self == other
{{/model}}
{{/models}}