mojo/public/tools/mojom/mojom/parse/parser_unittest.py
def testModuleStatementAfterDefinition(self):
    """Tests an (invalid) .mojom with a module statement after a definition."""

    source = """\
        struct MyStruct {
          int32 a;
        };
        module foo;
        """
    with self.assertRaisesRegexp(
        parser.ParseError,
        r"^my_file\.mojom:4: Error: \"module\" statements must precede imports "
        r"and definitions:\n *module foo;$"):
      parser.Parse(source, "my_file.mojom")
Tests an (invalid) .mojom with a module statement after a definition.
Tests an (invalid) .mojom with a module statement after a definition.
Tests an ( invalid ) . mojom with a module statement after a definition .
def testModuleStatementAfterDefinition(self):
    source = """\
        struct MyStruct {
          int32 a;
        };
        module foo;
        """
    with self.assertRaisesRegexp(
        parser.ParseError,
        r"^my_file\.mojom:4: Error: \"module\" statements must precede imports "
        r"and definitions:\n *module foo;$"):
      parser.Parse(source, "my_file.mojom")
def testModuleStatementAfterDefinition ( self ) : source = """\
        struct MyStruct {
          int32 a;
        };
        module foo;
        """ with self . assertRaisesRegexp ( parser . ParseError , r"^my_file\.mojom:4: Error: \"module\" statements must precede imports " r"and definitions:\n *module foo;$" ) : parser . Parse ( source , "my_file.mojom" )
Tests an (invalid) .mojom with a module statement after a definition.
Tests an ( invalid ) . mojom with a module statement after a definition .
"""Tests an (invalid) .mojom with a module statement after a definition."""
self