Index: mojo/public/tools/bindings/pylib/mojom/parse/ast.py |
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/ast.py b/mojo/public/tools/bindings/pylib/mojom/parse/ast.py |
index 51d603695e5a91fbe711c3bf193d8c8b7b8eddbb..3712ed1445ff376ac0f1bb710b78a5b48d64381f 100644 |
--- a/mojo/public/tools/bindings/pylib/mojom/parse/ast.py |
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/ast.py |
@@ -20,6 +20,10 @@ class NodeBase(object): |
def __eq__(self, other): |
return type(self) == type(other) |
+ # Make != the inverse of ==. (Subclasses shouldn't have to override this.) |
+ def __ne__(self, other): |
+ return not self == other |
+ |
# TODO(vtl): Some of this is complicated enough that it should be tested. |
class NodeListBase(NodeBase): |
@@ -49,8 +53,7 @@ class NodeListBase(NodeBase): |
def __eq__(self, other): |
return super(NodeListBase, self).__eq__(other) and \ |
- len(self.items) == len(other.items) and \ |
- all(self.items[i] == other.items[i] for i in xrange(len(self.items))) |
+ self.items == other.items |
# Implement this so that on failure, we get slightly more sensible output. |
def __repr__(self): |