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

Side by Side Diff: mojo/python/tests/bindings_enums_unittest.py

Issue 551053002: mojo: Adding struct's fields for python bindings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding constructors. 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 # Generated files 7 # Generated files
8 # pylint: disable=F0401 8 # pylint: disable=F0401
9 import sample_import_mojom 9 import sample_import_mojom
10 import sample_service_mojom 10 import sample_service_mojom
11 11
12 12
13 class EnumBindingsTest(unittest.TestCase): 13 class EnumBindingsTest(unittest.TestCase):
14 14
15 # Testing enum classes are in the right module.
16 def testModule(self):
17 self.assertEquals(sample_import_mojom.Shape.__module__,
18 'sample_import_mojom')
19
15 # Testing that enum class have expected constant values. 20 # Testing that enum class have expected constant values.
16 def testTopLevelEnumGeneration(self): 21 def testTopLevelEnumGeneration(self):
17 self.assertEquals(sample_import_mojom.Shape.RECTANGLE, 1) 22 self.assertEquals(sample_import_mojom.Shape.RECTANGLE, 1)
18 self.assertEquals(sample_import_mojom.Shape.CIRCLE, 2) 23 self.assertEquals(sample_import_mojom.Shape.CIRCLE, 2)
19 self.assertEquals(sample_import_mojom.Shape.TRIANGLE, 3) 24 self.assertEquals(sample_import_mojom.Shape.TRIANGLE, 3)
20 self.assertEquals(sample_import_mojom.Shape.LAST, 25 self.assertEquals(sample_import_mojom.Shape.LAST,
21 sample_import_mojom.Shape.TRIANGLE) 26 sample_import_mojom.Shape.TRIANGLE)
22 27
23 self.assertEquals(sample_import_mojom.AnotherShape.RECTANGLE, 10) 28 self.assertEquals(sample_import_mojom.AnotherShape.RECTANGLE, 10)
24 self.assertEquals(sample_import_mojom.AnotherShape.CIRCLE, 11) 29 self.assertEquals(sample_import_mojom.AnotherShape.CIRCLE, 11)
(...skipping 22 matching lines...) Expand all
47 sample_import_mojom.Shape.VALUES 52 sample_import_mojom.Shape.VALUES
48 53
49 # Testing enum values are frozen. 54 # Testing enum values are frozen.
50 def testEnumFrozen(self): 55 def testEnumFrozen(self):
51 with self.assertRaises(AttributeError): 56 with self.assertRaises(AttributeError):
52 sample_import_mojom.Shape.RECTANGLE = 2 57 sample_import_mojom.Shape.RECTANGLE = 2
53 with self.assertRaises(AttributeError): 58 with self.assertRaises(AttributeError):
54 del sample_import_mojom.Shape.RECTANGLE 59 del sample_import_mojom.Shape.RECTANGLE
55 with self.assertRaises(AttributeError): 60 with self.assertRaises(AttributeError):
56 sample_import_mojom.Shape.NewShape = 4 61 sample_import_mojom.Shape.NewShape = 4
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698