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

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

Issue 517353002: mojo: Starting generator for python bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
new file mode 100644
index 0000000000000000000000000000000000000000..3f1f6c30823fc67b8443678ea2ae89fd1f843530
--- /dev/null
+++ b/mojo/python/tests/bindings_constants_unittest.py
@@ -0,0 +1,27 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import math
+import unittest
+
+# Generated files
+import sample_service_mojom
+
+
+class ConstantBindingsTest(unittest.TestCase):
+
+ def test_constant_generation(self):
+ self.assertEquals(sample_service_mojom.TWELVE, 12)
+ self.assertEquals(sample_service_mojom.TOO_BIG_FOR_SIGNED_INT64,
+ 9999999999999999999)
+ self.assertEquals(sample_service_mojom.DOUBLE_INFINITY,
+ float('inf'))
+ self.assertEquals(sample_service_mojom.DOUBLE_NEGATIVE_INFINITY,
+ float('-inf'))
+ self.assertTrue(math.isnan(sample_service_mojom.DOUBLE_NA_N))
pkl (ping after 24h if needed) 2014/09/01 12:52:02 Shouldn't DOUBLE_NA_N be DOUBLE_NAN instead?
qsr 2014/09/01 14:19:38 The issue is that the object is name NaN in the id
+ self.assertEquals(sample_service_mojom.FLOAT_INFINITY,
+ float('inf'))
+ self.assertEquals(sample_service_mojom.FLOAT_NEGATIVE_INFINITY,
+ float('-inf'))
+ self.assertTrue(math.isnan(sample_service_mojom.FLOAT_NA_N))

Powered by Google App Engine
This is Rietveld 408576698