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

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

Issue 548343005: mojo: Specialize native type arrays. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Follow review 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
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_python_generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/python/tests/bindings_structs_unittest.py
diff --git a/mojo/python/tests/bindings_structs_unittest.py b/mojo/python/tests/bindings_structs_unittest.py
index 6e4b63d4208eeb7b110ccdb1b9604d234154037e..f7746acd763158c1365942697bc46d8e59c04862 100644
--- a/mojo/python/tests/bindings_structs_unittest.py
+++ b/mojo/python/tests/bindings_structs_unittest.py
@@ -84,13 +84,13 @@ class StructBindingsTest(unittest.TestCase):
max_value = (1 << bits) - 1
entity.__setattr__(field_name, min_value)
entity.__setattr__(field_name, max_value)
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
entity.__setattr__(field_name, None)
- with self.assertRaises(ValueError):
+ with self.assertRaises(OverflowError):
entity.__setattr__(field_name, min_value - 1)
- with self.assertRaises(ValueError):
+ with self.assertRaises(OverflowError):
entity.__setattr__(field_name, max_value + 1)
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
entity.__setattr__(field_name, 'hello world')
def testTypes(self):
@@ -120,9 +120,9 @@ class StructBindingsTest(unittest.TestCase):
self.assertEquals(defaults_test.a12, True)
# Floating point types
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a13 = 'hello'
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a14 = 'hello'
# Array type
@@ -131,39 +131,39 @@ class StructBindingsTest(unittest.TestCase):
defaults_test.a18 = [ 0 ]
defaults_test.a18 = [ 255 ]
defaults_test.a18 = [ 0, 255 ]
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a18 = [[]]
- with self.assertRaises(ValueError):
+ with self.assertRaises(OverflowError):
defaults_test.a18 = [ -1 ]
- with self.assertRaises(ValueError):
+ with self.assertRaises(OverflowError):
defaults_test.a18 = [ 256 ]
# String type
defaults_test.a19 = None
defaults_test.a19 = ''
defaults_test.a19 = 'hello world'
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a19 = [[]]
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a19 = [ -1 ]
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a19 = [ 256 ]
# Structs
defaults_test.a21 = None
defaults_test.a21 = sample_import_mojom.Point()
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a21 = 1
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
defaults_test.a21 = sample_import2_mojom.Thing()
# Handles
foo_instance = sample_service_mojom.Foo()
foo_instance.source = None
foo_instance.source = mojo.system.Handle()
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
foo_instance.source = 1
- with self.assertRaises(ValueError):
+ with self.assertRaises(TypeError):
foo_instance.source = object()
def testConstructor(self):
« no previous file with comments | « mojo/public/tools/bindings/generators/mojom_python_generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698