当前位置: 首页>>代码示例>>Python>>正文


Python String.cast_方法代码示例

本文整理汇总了Python中java.lang.String.cast_方法的典型用法代码示例。如果您正苦于以下问题:Python String.cast_方法的具体用法?Python String.cast_怎么用?Python String.cast_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.lang.String的用法示例。


在下文中一共展示了String.cast_方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bigtest03

# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import cast_ [as 别名]
    def test_bigtest03(self):
        '''Get recids_hm_strstr'''

        message = self.bridge.createMessage('bigtest') \
                    .setParam('action', 'recids_hm_strstr') \
                    .setParam('size', self.size)

        self.bridge.sendMessage(message)
        res = HashMap.cast_(message.getResults())
        assert res.size() == self.size
        assert str(String.cast_(res.get('0'))) == '0'
        assert str(String.cast_(res.get('5'))) == '5'
开发者ID:lbjay,项目名称:montysolr,代码行数:14,代码来源:unittest_examples_bigtest.py

示例2: test_invenio_search

# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import cast_ [as 别名]
    def test_invenio_search(self):
        kws = HashMap() #.of_(String, List)
        p = ArrayList() #.of_(String)
        of = ArrayList() #.of_(String)
        rg = ArrayList() #.of_(String)
        
        p.add('recid:94')
        of.add('xm')
        
        kws.put('p', p)
        kws.put('of', of)
        
        message = self.bridge.createMessage('invenio_search') \
                    .setParam('kwargs', kws)

        self.bridge.sendMessage(message)
        result = str(String.cast_(message.getResults()))
        assert '<controlfield tag="001">94</controlfield>' in result
        
        
        
        p.clear()
        p.add('recid:0->50')
        message = self.bridge.createMessage('invenio_search') \
                    .setParam('kwargs', kws)
        self.bridge.sendMessage(message)
        result = str(String.cast_(message.getResults()))
        
        print result
        assert 'Search-Engine-Total-Number-Of-Results: 42' in result
        assert len(result) > 1000
        assert result.count('<record>') == 10
        
        rg.add('200')
        kws.put('rg', rg)
        
        message = self.bridge.createMessage('invenio_search') \
                    .setParam('kwargs', kws)
        self.bridge.sendMessage(message)
        result = str(String.cast_(message.getResults()))
        
        assert 'Search-Engine-Total-Number-Of-Results: 42' in result
        assert len(result) > 1000
        assert result.count('<record>') == 42
开发者ID:lbjay,项目名称:montysolr,代码行数:46,代码来源:unittest_targets.py

示例3: get_citation_dict

# 需要导入模块: from java.lang import String [as 别名]
# 或者: from java.lang.String import cast_ [as 别名]
def get_citation_dict(message):
    '''TODO: unittest'''
    dictname = String.cast_(message.getParam('dictname'))
    
    # we will call the local module (not dispatched remotely)
    if hasattr(api_calls, '_dispatch'):
        wid, cd = api_calls._dispatch("get_citation_dict", dictname)
    else:
        wid, cd = api_calls.dispatch("get_citation_dict", dictname)
    
    if cd:
        hm = HashMap().of_(String, JArray_int)
        for k,v in cd.items():
            j_array = JArray_int(v)
            hm.put(k, j_array)
        message.put('result', hm)
开发者ID:lbjay,项目名称:montysolr,代码行数:18,代码来源:targets.py


注:本文中的java.lang.String.cast_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。