mojo/public/tools/mojom/mojom/generate/translate_unittest.py
def testSelfRecursiveUnions(self):
    """Verifies _UnionField() raises when a union is self-recursive."""
    tree = ast.Mojom(None, ast.ImportList(), [
        ast.Union("SomeUnion", None,
                  ast.UnionBody([ast.UnionField("a", None, None, "SomeUnion")]))
    ])
    with self.assertRaises(Exception):
      translate.OrderedModule(tree, "mojom_tree", [])

    tree = ast.Mojom(None, ast.ImportList(), [
        ast.Union(
            "SomeUnion", None,
            ast.UnionBody([ast.UnionField("a", None, None, "SomeUnion?")]))
    ])
    with self.assertRaises(Exception):
      translate.OrderedModule(tree, "mojom_tree", [])
Verifies _UnionField() raises when a union is self-recursive.
Verifies _UnionField() raises when a union is self-recursive.
Verifies _UnionField () raises when a union is self - recursive .
def testSelfRecursiveUnions(self):
    tree = ast.Mojom(None, ast.ImportList(), [
        ast.Union("SomeUnion", None,
                  ast.UnionBody([ast.UnionField("a", None, None, "SomeUnion")]))
    ])
    with self.assertRaises(Exception):
      translate.OrderedModule(tree, "mojom_tree", [])
    tree = ast.Mojom(None, ast.ImportList(), [
        ast.Union(
            "SomeUnion", None,
            ast.UnionBody([ast.UnionField("a", None, None, "SomeUnion?")]))
    ])
    with self.assertRaises(Exception):
      translate.OrderedModule(tree, "mojom_tree", [])
def testSelfRecursiveUnions ( self ) : tree = ast . Mojom ( None , ast . ImportList ( ) , [ ast . Union ( "SomeUnion" , None , ast . UnionBody ( [ ast . UnionField ( "a" , None , None , "SomeUnion" ) ] ) ) ] ) with self . assertRaises ( Exception ) : translate . OrderedModule ( tree , "mojom_tree" , [ ] ) tree = ast . Mojom ( None , ast . ImportList ( ) , [ ast . Union ( "SomeUnion" , None , ast . UnionBody ( [ ast . UnionField ( "a" , None , None , "SomeUnion?" ) ] ) ) ] ) with self . assertRaises ( Exception ) : translate . OrderedModule ( tree , "mojom_tree" , [ ] )
Verifies _UnionField() raises when a union is self-recursive.
Verifies _UnionField () raises when a union is self - recursive .
"""Verifies _UnionField() raises when a union is self-recursive."""
self