本文整理汇总了Python中test_utils.TestUtils.buffers_equal方法的典型用法代码示例。如果您正苦于以下问题:Python TestUtils.buffers_equal方法的具体用法?Python TestUtils.buffers_equal怎么用?Python TestUtils.buffers_equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_utils.TestUtils
的用法示例。
在下文中一共展示了TestUtils.buffers_equal方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: data_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def data_handler(data):
tu.check_context()
received.append_buffer(data)
if received.length == sends * size:
tu.azzert(TestUtils.buffers_equal(sent, received))
tu.test_complete()
示例2: end_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def end_handler(stream):
tu.azzert(TestUtils.buffers_equal(tot_buff, tot_read))
tu.check_context
def close_handler2(err, result):
tu.check_context()
tu.test_complete()
file.close(close_handler2)
示例3: end_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def end_handler(stream):
tu.check_context()
tu.azzert(TestUtils.buffers_equal(sent_buff, body))
if chunked:
tu.azzert('vtrailer1' == resp.trailers['trailer1'])
tu.azzert('vtrailer2' == resp.trailers['trailer2'])
tu.test_complete()
示例4: end_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def end_handler(stream):
tu.check_context()
if method != "HEAD" and method != "CONNECT":
tu.azzert(TestUtils.buffers_equal(sent_buff, body))
if chunked:
tu.azzert("vtrailer1" == resp.trailers["trailer1"])
tu.azzert("vtrailer2" == resp.trailers["trailer2"])
tu.test_complete()
示例5: test_hash
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def test_hash(self):
hash1 = SharedData.get_hash("map1")
tu.azzert(hash1 != None)
hash2 = SharedData.get_hash("map1")
tu.azzert(hash2 != None)
tu.azzert(hash1 == hash2)
hash3 = SharedData.get_hash("map3")
tu.azzert(hash3 != None)
tu.azzert(hash1 != hash3)
key = 'wibble'
hash1[key] = 'hello'
tu.azzert(hash1[key] == 'hello')
tu.azzert(hash2[key] == 'hello')
tu.azzert(isinstance(hash1[key], unicode)) # Make sure it's not a Java String
hash1[key] = 12
tu.azzert(hash1[key] == 12)
tu.azzert(hash2[key] == 12)
hash1[key] = 1.2344
tu.azzert(hash1[key] == 1.2344)
tu.azzert(hash2[key] == 1.2344)
hash1[key] = True
tu.azzert(hash1[key] == True)
tu.azzert(hash2[key] == True)
hash1[key] = False
tu.azzert(hash1[key] == False)
tu.azzert(hash2[key] == False)
succeeded = False
try:
hash1[key] = SomeOtherClass()
succeeded = True
except:
pass # OK
tu.azzert(not succeeded, 'Should throw exception')
# Make sure it deals with Ruby buffers ok, and copies them
buff1 = TestUtils.gen_buffer(100)
hash1[key] = buff1
buff2 = hash1[key]
tu.azzert(isinstance(buff2, Buffer))
tu.azzert(buff1 != buff2)
tu.azzert(TestUtils.buffers_equal(buff1, buff2))
tu.azzert(SharedData.remove_hash("map1"))
tu.azzert(not SharedData.remove_hash("map1"))
tu.azzert(SharedData.remove_hash("map3"))
tu.test_complete()
示例6: data_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def data_handler(data):
tu.check_thread()
tu.azzert(TestUtils.buffers_equal(buffer, data.data))
def send_handler(err, sock):
tu.check_thread()
tu.azzert(err is None)
tu.azzert(sock == peer2)
peer2.send('127.0.0.1', 1235, data.data, send_handler)
示例7: read_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def read_handler(err, buff):
tu.check_context
tu.azzert(err == None)
self.read += 1
if self.read == num_chunks:
# all read
tu.azzert(TestUtils.buffers_equal(tot_buff, tot_read))
def close_handler(err, res):
tu.check_context()
tu.test_complete()
file.close(close_handler)
示例8: end_handler
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def end_handler():
tu.check_thread()
if method != 'HEAD' and method != 'CONNECT':
tu.azzert(TestUtils.buffers_equal(sent_buff, body))
if chunked:
tu.azzert('vtrailer1' == resp.trailers['trailer1'])
tu.azzert('vtrailer2' == resp.trailers['trailer2'])
resp.headers.clear()
tu.azzert(resp.headers.is_empty)
tu.test_complete()
示例9: each7
# 需要导入模块: from test_utils import TestUtils [as 别名]
# 或者: from test_utils.TestUtils import buffers_equal [as 别名]
def each7(elem):
tu.azzert(TestUtils.buffers_equal(buff, elem))
tu.azzert(buff != elem)
tu.azzert(isinstance(elem, Buffer))