本文整理汇总了Python中TestEnv.TestEnv.checkComplainAndAdjustExpected方法的典型用法代码示例。如果您正苦于以下问题:Python TestEnv.checkComplainAndAdjustExpected方法的具体用法?Python TestEnv.checkComplainAndAdjustExpected怎么用?Python TestEnv.checkComplainAndAdjustExpected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestEnv.TestEnv
的用法示例。
在下文中一共展示了TestEnv.checkComplainAndAdjustExpected方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEnv
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import checkComplainAndAdjustExpected [as 别名]
import gdbm
from TestEnv import TestEnv
if not os.path.isdir( 'work'):
os.mkdir( 'work')
try:
os.remove( 'work/dbm_db')
except:
pass
dbm_db= gdbm.open( 'work/dbm_db', 'c')
te= TestEnv()
te.checkComplainAndAdjustExpected( 0)
te.test( None == dbm_db.firstkey())
keysPut= []
for x in range( 1, 10): # 8bb46c596f2b47f8a36eae9da5bdbca9
key= str( x)
dbm_db[ key]= key # 387533fff7d649cf8d8689cbe9e81307
keysPut.append( key)
keysCmp= []
key= dbm_db.firstkey()
try:
while not None == key:
示例2: TestEnv
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import checkComplainAndAdjustExpected [as 别名]
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:encoding=utf-8
import sys
from TestEnv import TestEnv
te = TestEnv()
te.checkComplainAndAdjustExpected(0)
te.test(isinstance(str(), str))
te.test(isinstance("", str))
te.test(isinstance("", str))
te.test(isinstance(int(), int))
te.test(isinstance(1, int))
te.test(isinstance(float(), float))
te.test(isinstance(1.0, float))
te.test(isinstance(long(), long))
te.test(isinstance(1L, long))
te.test(isinstance(complex(), complex))
te.test(isinstance(3 + 7j, complex))
te.test(isinstance(dict(), dict))
te.test(isinstance({}, dict))
te.test(isinstance(list(), list))
te.test(isinstance([], list))
te.test(isinstance(tuple(), tuple))
te.test(isinstance((), tuple))
te.test(not isinstance((1), tuple))
te.test(isinstance((1), int))
示例3: TestEnv
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import checkComplainAndAdjustExpected [as 别名]
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:encoding=utf-8
from TestEnv import TestEnv
te= TestEnv()
te.checkComplainAndAdjustExpected( 0)
def f( a, b):
te.test( True)
return ( a, b)
te.test( (1, 2)==f(1, 2))
te.test( (1, 2)==f( b=2, a=1))
te.checkComplainAndAdjustExpected( 4)
te.test( (1, 2)==apply( f, (1, 2)))
te.test( (1, 2)==apply( f, (1, 2), dict()))
te.test( (1, 2)==apply( f, (1, 2), {}))
te.test( (1, 2)==apply( f, (1,), { 'b': 2}))
te.test( (1, 2)==apply( f, [1], { 'b': 2}))
te.test( (1, 2)==apply( f, [], { 'b': 2, 'a': 1}))
te.test( (1, 2)==f( *[1, 2], **{}))
te.test( (1, 2)==f( *[1], **{'b': 2}))
示例4: TestEnv
# 需要导入模块: from TestEnv import TestEnv [as 别名]
# 或者: from TestEnv.TestEnv import checkComplainAndAdjustExpected [as 别名]
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi:encoding=utf-8
from TestEnv import TestEnv
te= TestEnv()
te.checkComplainAndAdjustExpected( 0)
te.test( [1, 2, 3] == range( 1, 4))
te.test( [0, 2, 4] == range( 0, 5, 2))
te.test( 2 == [1, 2, 3][1])
te.test( 3 == [1, 2, 3][-1])
te.test( [1, 2, 3] == [1, 2, 3][0:3])
te.test( [2, 3] == [1, 2, 3][1:])
te.test( [1] == [1, 2, 3][:1])
te.test( [1, 2] == [1, 2, 3][:-1])
te.test( [1, 2, 3] == [ x for x in [1, 2, 3]])
te.test( [[1, 3], [1, 4], [2, 3], [2, 4]] == [[x,y] for x in [1, 2] for y in [3, 4]])
te.test( [[1, 3], [2, 4]] == [[x,y] for x in [1, 2] for y in [3, 4] if (x+2)==y])
te.checkComplainAndAdjustExpected( 11)
l= []
l[ 3: len( l)]= [1, 2]
te.test( [1, 2] == l)