コード例 #1
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_annotation_argument(self):
     annotation = ast.Annotation('SomeAnnotation', 'value')
     arg = ast.Argument('Argument', ast.Argument.DIRECTION_IN, 's', {
         'SomeAnnotation': annotation,
     })
     method = ast.Method('AMethod', [arg])
     ast.Interface('Some.Interface', {
         'AMethod': method,
     })
     self.assertEqual(
         annotation.format_name(), 'SomeAnnotation of ‘0 (‘Argument’)'
         ' of method ‘Some.Interface.AMethod’’')
コード例 #2
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
    def test_argument(self):
        annotation = ast.Annotation('SomeAnnotation', 'value')
        self.assertEqual(annotation.parent, None)

        arg = ast.Argument('SomeArgument', ast.Argument.DIRECTION_IN, 's', {
            'SomeAnnotation': annotation,
        })
        self.assertEqual(arg.parent, None)
        self.assertEqual(arg.index, -1)
        self.assertEqual(annotation.parent, arg)

        method = ast.Method('AMethod', [arg])
        self.assertEqual(arg.parent, method)
        self.assertEqual(arg.index, 0)
コード例 #3
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_argument_unnamed_unparented(self):
     arg = ast.Argument(None, ast.Argument.DIRECTION_IN, 's')
     self.assertEqual(arg.format_name(), 'unnamed')
コード例 #4
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_argument_unnamed(self):
     arg = ast.Argument(None, ast.Argument.DIRECTION_IN, 's')
     ast.Method('ParentMethod', [arg])
     self.assertEqual(arg.format_name(), '0 of method ‘ParentMethod’')
コード例 #5
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_argument_unparented(self):
     arg = ast.Argument('self', ast.Argument.DIRECTION_IN, 's')
     self.assertEqual(arg.format_name(), '‘self’')
コード例 #6
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_argument(self):
     arg = ast.Argument('self', ast.Argument.DIRECTION_IN, 's')
     ast.Method('ParentMethod', [arg])
     self.assertEqual(arg.format_name(),
                      '0 (‘self’) of method ‘ParentMethod’')
コード例 #7
0
ファイル: test_ast.py プロジェクト: pwithnall/dbus-deviation
 def test_argument(self):
     arg = ast.Argument('self', ast.Argument.DIRECTION_IN, 's')
     self.assertIsInstance(arg.type, TypeSignature)
     self.assertEqual(str(arg.type), 's')