mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testInvalidEnumInitializers(self):
    """Tests that invalid enum initializers are correctly detected."""

    # Floating point value.
    source2 = "enum MyEnum { VALUE = 0.123 };"
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '0\.123':\n"
        r"enum MyEnum { VALUE = 0\.123 };$"):
      parser.Parse(source2, "my_file.mojom")

    # Boolean value.
    source2 = "enum MyEnum { VALUE = true };"
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected 'true':\n"
        r"enum MyEnum { VALUE = true };$"):
      parser.Parse(source2, "my_file.mojom")
Tests that invalid enum initializers are correctly detected.
Tests that invalid enum initializers are correctly detected.
Tests that invalid enum initializers are correctly detected .
def testInvalidEnumInitializers(self):
    source2 = "enum MyEnum { VALUE = 0.123 };"
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected '0\.123':\n"
        r"enum MyEnum { VALUE = 0\.123 };$"):
      parser.Parse(source2, "my_file.mojom")
    source2 = "enum MyEnum { VALUE = true };"
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:1: Error: Unexpected 'true':\n"
        r"enum MyEnum { VALUE = true };$"):
      parser.Parse(source2, "my_file.mojom")
def testInvalidEnumInitializers ( self ) : source2 = "enum MyEnum { VALUE = 0.123 };" with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:1: Error: Unexpected '0\.123':\n" r"enum MyEnum { VALUE = 0\.123 };$" ) : parser . Parse ( source2 , "my_file.mojom" ) source2 = "enum MyEnum { VALUE = true };" with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:1: Error: Unexpected 'true':\n" r"enum MyEnum { VALUE = true };$" ) : parser . Parse ( source2 , "my_file.mojom" )
Tests that invalid enum initializers are correctly detected.
Tests that invalid enum initializers are correctly detected .
"""Tests that invalid enum initializers are correctly detected.""" # Floating point value. # Boolean value.
self