Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Unified Diff: mojo/public/tools/bindings/pylib/mojom/parse/ast.py

Issue 395243002: Mojom: Add some tests for mojom.parse.ast. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom_tests/parse/ast_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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):
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/mojom_tests/parse/ast_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698