Python inspect 模块,Arguments() 实例源码

我们从Python开源项目中,提取了以下25个代码示例,用于说明如何使用inspect.Arguments()

项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_no_args(self):
        self.app.get('/')
        assert self.args[0] == self.root.index
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_arg(self):
        self.app.get('/greet/joe')
        assert self.args[0] == self.root.greet
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['joe']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_vararg(self):
        self.app.get('/greetmore/joe')
        assert self.args[0] == self.root.greetmore
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == ['joe']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_kw(self):
        self.app.get('/kwargs/?name=joe')
        assert self.args[0] == self.root.kwargs
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'name': 'joe'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_kw_post(self):
        self.app.post('/kwargs/', params={'name': 'joe'})
        assert self.args[0] == self.root.kwargs
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'name': 'joe'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_no_args(self):
        self.app.get('/')
        assert self.args[0] == self.root.index
        assert isinstance(self.args[1], inspect.Arguments)
        assert len(self.args[1].args) == 2
        assert isinstance(self.args[1].args[0], Request)
        assert isinstance(self.args[1].args[1], Response)
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_arg(self):
        self.app.get('/greet/joe')
        assert self.args[0] == self.root.greet
        assert isinstance(self.args[1], inspect.Arguments)
        assert len(self.args[1].args) == 3
        assert isinstance(self.args[1].args[0], Request)
        assert isinstance(self.args[1].args[1], Response)
        assert self.args[1].args[2] == 'joe'
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_vararg(self):
        self.app.get('/greetmore/joe')
        assert self.args[0] == self.root.greetmore
        assert isinstance(self.args[1], inspect.Arguments)
        assert len(self.args[1].args) == 2
        assert isinstance(self.args[1].args[0], Request)
        assert isinstance(self.args[1].args[1], Response)
        assert self.args[1].varargs == ['joe']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_kw(self):
        self.app.get('/kwargs/?name=joe')
        assert self.args[0] == self.root.kwargs
        assert isinstance(self.args[1], inspect.Arguments)
        assert len(self.args[1].args) == 2
        assert isinstance(self.args[1].args[0], Request)
        assert isinstance(self.args[1].args[1], Response)
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'name': 'joe'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_single_kw_post(self):
        self.app.post('/kwargs/', params={'name': 'joe'})
        assert self.args[0] == self.root.kwargs
        assert isinstance(self.args[1], inspect.Arguments)
        assert len(self.args[1].args) == 2
        assert isinstance(self.args[1].args[0], Request)
        assert isinstance(self.args[1].args[1], Response)
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'name': 'joe'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_get_all(self):
        self.app.get('/')
        assert self.args[0] == self.root.get_all
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_get_all_with_kwargs(self):
        self.app.get('/?foo=bar')
        assert self.args[0] == self.root.get_all
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'foo': 'bar'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_get_one(self):
        self.app.get('/1')
        assert self.args[0] == self.root.get_one
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_get_one_with_varargs(self):
        self.app.get('/1/2/3')
        assert self.args[0] == self.root.get_one
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == ['2', '3']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_get_one_with_kwargs(self):
        self.app.get('/1?foo=bar')
        assert self.args[0] == self.root.get_one
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'foo': 'bar'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_post_with_varargs(self):
        self.app.post('/foo/bar')
        assert self.args[0] == self.root.post
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == ['foo', 'bar']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_post_with_kwargs(self):
        self.app.post('/', params={'foo': 'bar'})
        assert self.args[0] == self.root.post
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == []
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'foo': 'bar'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_put(self):
        self.app.put('/1')
        assert self.args[0] == self.root.put
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_put_with_method_argument(self):
        self.app.post('/1?_method=put')
        assert self.args[0] == self.root.put
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'_method': 'put'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_put_with_varargs(self):
        self.app.put('/1/2/3')
        assert self.args[0] == self.root.put
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == ['2', '3']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_delete(self):
        self.app.delete('/1')
        assert self.args[0] == self.root.delete
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_delete_with_method_argument(self):
        self.app.post('/1?_method=delete')
        assert self.args[0] == self.root.delete
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'_method': 'delete'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_delete_with_varargs(self):
        self.app.delete('/1/2/3')
        assert self.args[0] == self.root.delete
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == ['2', '3']
        assert kwargs(self.args[1]) == {}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_delete_with_kwargs(self):
        self.app.delete('/1?foo=bar')
        assert self.args[0] == self.root.delete
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'foo': 'bar'}
项目:deb-python-pecan    作者:openstack    | 项目源码 | 文件源码
def test_post_with_invalid_method_kwarg(self):
        self.app.post('/1?_method=invalid')
        assert self.args[0] == self.root._default
        assert isinstance(self.args[1], inspect.Arguments)
        assert self.args[1].args == ['1']
        assert self.args[1].varargs == []
        assert kwargs(self.args[1]) == {'_method': 'invalid'}