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

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