mojo/public/tools/mojom/stable_attribute_unittest.py
def testStableAttributeTagging(self):
    """Verify that we recognize the [Stable] attribute on relevant definitions
    and the resulting parser outputs are tagged accordingly."""
    mojom = 'test.mojom'
    self.WriteFile(
        mojom, """\
        [Stable] enum TestEnum { kFoo };
        enum UnstableEnum { kBar };
        [Stable] struct TestStruct { TestEnum a; };
        struct UnstableStruct { UnstableEnum a; };
        [Stable] union TestUnion { TestEnum a; TestStruct b; };
        union UnstableUnion { UnstableEnum a; UnstableStruct b; };
        [Stable] interface TestInterface { Foo@0(TestUnion x) => (); };
        interface UnstableInterface { Foo(UnstableUnion x) => (); };
        """)
    self.ParseMojoms([mojom])

    m = self.LoadModule(mojom)
    self.assertEqual(2, len(m.enums))
    self.assertTrue(m.enums[0].stable)
    self.assertFalse(m.enums[1].stable)
    self.assertEqual(2, len(m.structs))
    self.assertTrue(m.structs[0].stable)
    self.assertFalse(m.structs[1].stable)
    self.assertEqual(2, len(m.unions))
    self.assertTrue(m.unions[0].stable)
    self.assertFalse(m.unions[1].stable)
    self.assertEqual(2, len(m.interfaces))
    self.assertTrue(m.interfaces[0].stable)
    self.assertFalse(m.interfaces[1].stable)
Verify that we recognize the [Stable] attribute on relevant definitions
    and the resulting parser outputs are tagged accordingly.
Verify that we recognize the [Stable] attribute on relevant definitions
and the resulting parser outputs are tagged accordingly.
Verify that we recognize the [ Stable ] attribute on relevant definitions and the resulting parser outputs are tagged accordingly .
def testStableAttributeTagging(self):
    mojom = 'test.mojom'
    self.WriteFile(
        mojom, """\
        [Stable] enum TestEnum { kFoo };
        enum UnstableEnum { kBar };
        [Stable] struct TestStruct { TestEnum a; };
        struct UnstableStruct { UnstableEnum a; };
        [Stable] union TestUnion { TestEnum a; TestStruct b; };
        union UnstableUnion { UnstableEnum a; UnstableStruct b; };
        [Stable] interface TestInterface { Foo@0(TestUnion x) => (); };
        interface UnstableInterface { Foo(UnstableUnion x) => (); };
        """)
    self.ParseMojoms([mojom])
    m = self.LoadModule(mojom)
    self.assertEqual(2, len(m.enums))
    self.assertTrue(m.enums[0].stable)
    self.assertFalse(m.enums[1].stable)
    self.assertEqual(2, len(m.structs))
    self.assertTrue(m.structs[0].stable)
    self.assertFalse(m.structs[1].stable)
    self.assertEqual(2, len(m.unions))
    self.assertTrue(m.unions[0].stable)
    self.assertFalse(m.unions[1].stable)
    self.assertEqual(2, len(m.interfaces))
    self.assertTrue(m.interfaces[0].stable)
    self.assertFalse(m.interfaces[1].stable)
def testStableAttributeTagging ( self ) : mojom = 'test.mojom' self . WriteFile ( mojom , """\
        [Stable] enum TestEnum { kFoo };
        enum UnstableEnum { kBar };
        [Stable] struct TestStruct { TestEnum a; };
        struct UnstableStruct { UnstableEnum a; };
        [Stable] union TestUnion { TestEnum a; TestStruct b; };
        union UnstableUnion { UnstableEnum a; UnstableStruct b; };
        [Stable] interface TestInterface { Foo@0(TestUnion x) => (); };
        interface UnstableInterface { Foo(UnstableUnion x) => (); };
        """ ) self . ParseMojoms ( [ mojom ] ) m = self . LoadModule ( mojom ) self . assertEqual ( 2 , len ( m . enums ) ) self . assertTrue ( m . enums [ 0 ] . stable ) self . assertFalse ( m . enums [ 1 ] . stable ) self . assertEqual ( 2 , len ( m . structs ) ) self . assertTrue ( m . structs [ 0 ] . stable ) self . assertFalse ( m . structs [ 1 ] . stable ) self . assertEqual ( 2 , len ( m . unions ) ) self . assertTrue ( m . unions [ 0 ] . stable ) self . assertFalse ( m . unions [ 1 ] . stable ) self . assertEqual ( 2 , len ( m . interfaces ) ) self . assertTrue ( m . interfaces [ 0 ] . stable ) self . assertFalse ( m . interfaces [ 1 ] . stable )
Verify that we recognize the [Stable] attribute on relevant definitions
and the resulting parser outputs are tagged accordingly.
Verify that we recognize the [ Stable ] attribute on relevant definitions and the resulting parser outputs are tagged accordingly .
"""Verify that we recognize the [Stable] attribute on relevant definitions
    and the resulting parser outputs are tagged accordingly."""
self