コード例 #1
0
 def test_package_annotation(self):
     m = self.parser.parse_string('''
     @Annot
     package foo;
     ''')
     self.assertEqual(
         m.package_declaration,
         model.PackageDeclaration(
             model.Name('foo'),
             modifiers=[model.Annotation(model.Name('Annot'))]))
コード例 #2
0
    def test_annotations(self):
        # bug #13
        m = self.parser.parse_string('''
        @Annot(key = 1)
        class Foo {}
        ''')
        t = self._assert_declaration(m, 'Foo')

        self.assertEqual(t.modifiers, [
            model.Annotation(name=model.Name('Annot'),
                             members=[
                                 model.AnnotationMember(
                                     name=model.Name('key'),
                                     value=model.Literal('1'))
                             ])
        ])