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

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: Make structs immutable. 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 2b8aceeb526f3616ef7965996dc8885b24fade1a..28fcaf521ca4f03432528cfc105e16f7df11d6b5 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

Powered by Google App Engine
This is Rietveld 408576698