OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import unittest |
| 6 |
| 7 # Generated files |
| 8 # pylint: disable=F0401 |
| 9 import sample_import_mojom |
| 10 |
| 11 |
| 12 class EnumBindingsTest(unittest.TestCase): |
| 13 |
| 14 # Testing that enum class have expected constant values. |
| 15 def testTopLevelEnumGeneration(self): |
| 16 self.assertEquals(sample_import_mojom.Shape.RECTANGLE, 1) |
| 17 self.assertEquals(sample_import_mojom.Shape.CIRCLE, 2) |
| 18 self.assertEquals(sample_import_mojom.Shape.TRIANGLE, 3) |
| 19 |
| 20 self.assertEquals(sample_import_mojom.AnotherShape.RECTANGLE, 10) |
| 21 self.assertEquals(sample_import_mojom.AnotherShape.CIRCLE, 11) |
| 22 self.assertEquals(sample_import_mojom.AnotherShape.TRIANGLE, 12) |
| 23 |
| 24 self.assertEquals(sample_import_mojom.YetAnotherShape.RECTANGLE, 20) |
| 25 self.assertEquals(sample_import_mojom.YetAnotherShape.CIRCLE, 21) |
| 26 self.assertEquals(sample_import_mojom.YetAnotherShape.TRIANGLE, 22) |
| 27 |
| 28 # Testing an enum class cannot be instantiated. |
| 29 def testNonInstantiableEnum(self): |
| 30 with self.assertRaises(TypeError): |
| 31 sample_import_mojom.Shape() |
| 32 |
| 33 # Testing an enum does not contain the VALUES constant. |
| 34 def testNoVALUESConstant(self): |
| 35 with self.assertRaises(AttributeError): |
| 36 # pylint: disable=W0104 |
| 37 sample_import_mojom.Shape.VALUES |
OLD | NEW |