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

Unified Diff: mojo/python/tests/bindings_constants_unittest.py

Issue 538613005: mojo: Start generating structs for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + fix constant array Created 6 years, 3 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
Index: mojo/python/tests/bindings_constants_unittest.py
diff --git a/mojo/python/tests/bindings_constants_unittest.py b/mojo/python/tests/bindings_constants_unittest.py
index ea8c651b9566d4175723f03581c33b03c90ffdce..85e97c602b5d734445d969d1eb06329672ed0515 100644
--- a/mojo/python/tests/bindings_constants_unittest.py
+++ b/mojo/python/tests/bindings_constants_unittest.py
@@ -26,3 +26,14 @@ class ConstantBindingsTest(unittest.TestCase):
self.assertEquals(sample_service_mojom.FLOAT_NEGATIVE_INFINITY,
float('-inf'))
self.assertTrue(math.isnan(sample_service_mojom.FLOAT_NA_N))
+
+ def testConstantOnStructGeneration(self):
+ self.assertEquals(sample_service_mojom.Foo.FOOBY, "Fooby")
+
+ def testStructImmutability(self):
+ with self.assertRaises(AttributeError):
+ sample_service_mojom.Foo.FOOBY = 0
+ with self.assertRaises(AttributeError):
+ del sample_service_mojom.Foo.FOOBY
+ with self.assertRaises(AttributeError):
+ sample_service_mojom.Foo.BAR = 1
sdefresne 2014/09/09 08:51:57 Q: just to be sure, but this is testing that user
qsr 2014/09/09 08:55:10 Exactly.

Powered by Google App Engine
This is Rietveld 408576698