mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testInvalidMethods(self):
    """Tests that invalid method declarations are correctly detected."""

    # No trailing commas.
    source1 = """\
        interface MyInterface {
          MyMethod(string a,);
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\)':\n"
        r" *MyMethod\(string a,\);$"):
      parser.Parse(source1, "my_file.mojom")

    # No leading commas.
    source2 = """\
        interface MyInterface {
          MyMethod(, string a);
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected ',':\n"
        r" *MyMethod\(, string a\);$"):
      parser.Parse(source2, "my_file.mojom")
Tests that invalid method declarations are correctly detected.
Tests that invalid method declarations are correctly detected.
Tests that invalid method declarations are correctly detected .
def testInvalidMethods(self):
    source1 = """\
        interface MyInterface {
          MyMethod(string a,);
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected '\)':\n"
        r" *MyMethod\(string a,\);$"):
      parser.Parse(source1, "my_file.mojom")
    source2 = """\
        interface MyInterface {
          MyMethod(, string a);
        };
        """
    with self.assertRaisesRegexp(
        parser.ParseError, r"^my_file\.mojom:2: Error: Unexpected ',':\n"
        r" *MyMethod\(, string a\);$"):
      parser.Parse(source2, "my_file.mojom")
def testInvalidMethods ( self ) : source1 = """\
        interface MyInterface {
          MyMethod(string a,);
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:2: Error: Unexpected '\)':\n" r" *MyMethod\(string a,\);$" ) : parser . Parse ( source1 , "my_file.mojom" ) source2 = """\
        interface MyInterface {
          MyMethod(, string a);
        };
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:2: Error: Unexpected ',':\n" r" *MyMethod\(, string a\);$" ) : parser . Parse ( source2 , "my_file.mojom" )
Tests that invalid method declarations are correctly detected.
Tests that invalid method declarations are correctly detected .
"""Tests that invalid method declarations are correctly detected.""" # No trailing commas. # No leading commas.
self