本文整理汇总了Python中waldo.lib.Waldo.no_partner_create方法的典型用法代码示例。如果您正苦于以下问题:Python Waldo.no_partner_create方法的具体用法?Python Waldo.no_partner_create怎么用?Python Waldo.no_partner_create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waldo.lib.Waldo
的用法示例。
在下文中一共展示了Waldo.no_partner_create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
"""
Tests whether Waldo can propagate an application exception back through an
endpoint call.
Returns true if the test passes and false otherwise.
"""
thrower = Waldo.no_partner_create(SingleSide, None)
catcher = Waldo.no_partner_create(SingleSide, thrower)
return catcher.test_catch()
示例2: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
'''
Tests the try...finally statement (without the use of catch).
Returns true if an error may be propagated through a try...finally
and handled later while having the code in the finally block
execute.
'''
catcher = Waldo.no_partner_create(Catcher)
thrower = Waldo.no_partner_create(Thrower)
catcher.addEndpoint(thrower)
thrower.addEndpoint(catcher)
return catcher.testTryFinally()
示例3: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
id_tester = Waldo.no_partner_create(IdTester)
id = id_tester.id()
manager = Waldo.no_partner_create(Manager)
manager_id = manager.id()
manager.add_endpoint(id_tester)
if id != id_tester._uuid or manager_id != manager._uuid:
return False
elif id_tester.get_id() != id_tester.id() or manager.get_id() != manager.id():
return False
elif id != manager.get_managed_endpoint_id():
return False
else:
return True
示例4: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
num_to_assign = 30
single_side.assign_num_to_number_struct(num_to_assign)
if single_side.read_num_from_number_struct() != num_to_assign:
print '\nErr: could not write user struct number'
return False
# tests nesting user structs
outer_nested_num = 52
inner_nested_num = 31
single_side.assign_num_to_nested_struct(
outer_nested_num,inner_nested_num)
if single_side.get_outer_and_inner_nested_nums() != (outer_nested_num,inner_nested_num):
print '\nErr with nested user structs'
return False
# tests passing struct through argument to method
new_num = 1
if single_side.get_endpoint_nested_struct_num(new_num) != new_num:
print '\nError passing structs through as method args'
return False
return True
示例5: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(
SingleSide, min_func,max_func,mod_func)
# to mod between
mod_tuples_list = [
(6,2),
(5,3),
(100,3),
(38, 7)]
for mod_tuple in mod_tuples_list:
if single_side.test_mod(*mod_tuple) != mod_func(None,*mod_tuple):
print '\nErr with mod call'
return False
# to max
max_min_list_list = [
list(range(205,150, -1)),
[-1, 52,1,0],
[73, 13.25,100,239]]
for max_min_list in max_min_list_list:
if single_side.test_max(max_min_list) != max_func(None,max_min_list):
print '\nErr with max call'
return False
# to min
for max_min_list in max_min_list_list:
if single_side.test_min(max_min_list) != min_func(None,max_min_list):
print '\nErr with min call'
return False
return True
示例6: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
if not test_ext_num(single_side):
return False
return True
示例7: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
if (1, 2, 3) != single_side.return_static_nums():
print "\nErr getting static numbers"
return False
if (1, 2, 3) != single_side.return_func_call_nums():
print "\nErr getting func call numbers"
return False
if ("a", "b") != single_side.return_variable_texts():
print "\nErr getting variable texts"
return False
if ("a", "b") != single_side.return_func_call_variable_texts():
print "\nErr getting func call variable texts"
return False
if ("a", "b", "c") != single_side.return_extended_texts():
print "\nErr getting extended texts"
return False
for i in range(1, 15):
if (i, i) != single_side.return_tuple_endpoint_global():
print "\nErr: incorrect tuple value of mutated state"
return False
for j in range(i + 1, i + 15):
if (j, j, 0) != single_side.wrapped_tuple():
print "\nErr: incorrect tuple value of wrapped mutated state"
return False
return True
示例8: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
single_side.do_nothing()
single_side.stop()
try:
single_side.do_nothing()
except Waldo.StoppedException as inst:
return True
return False
示例9: run_server
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_server():
'''
Runs the multi-connection chat server.
'''
global server
server = Waldo.no_partner_create(Server, display_msg)
print server
Waldo.tcp_accept(ClientHandler, HOSTNAME, PORT, server, display_msg)
while True:
time.sleep(SLEEP_TIME)
示例10: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
single_side = Waldo.no_partner_create(SingleSide)
if not test_maps(single_side):
return False
if not test_lists(single_side):
return False
return True
示例11: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
# for single side tests, these values do not really matter.
host_uuid = 10
single_side = Waldo.no_partner_create(
SingleSide, text_identity,text_len,list_sum,no_return,
sum_three_args,return_three_args)
test_strings_list = ['hello','wow','my','good','this is it']
# test identity text call
for string in test_strings_list:
if not single_side.execute_identity_endpoint_func (string):
print '\nErr in identity func call'
return False
# test len text call
for string in test_strings_list:
if not single_side.execute_len_endpoint_func (string):
print '\nErr in len func call'
return False
test_nums_list = [
list(range(0,13)),
list(range(50,500,2)),
[1.2,3.9,-1.3]]
# test sum list call
for num_list in test_nums_list:
if not single_side.execute_sum_list_endpoint_func (num_list):
print '\nErr in sum list func call'
return False
# execute no return
single_side.execute_no_return_endpoint_func()
# test multiple arguments
mult_args_array = [
(1,3,5),
(38,10,1000),
(-1.4,-50,10)
]
for arg_tuple in mult_args_array:
if not single_side.execute_sum_three_args_endpoint_func(*arg_tuple):
print '\nErr: with multiple arguments to functions'
return False
# test multiple return arguments
for arg_tuple in mult_args_array:
if single_side.execute_return_three_args_endpoint_func(*arg_tuple) != arg_tuple:
print '\nErr could not return tuple'
return False
return True
示例12: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
'''
Returns true on success.
'''
firstEndpoint = Waldo.no_partner_create(SelfTester)
secondEndpoint = firstEndpoint.get_self()
if firstEndpoint != secondEndpoint:
return False
elif secondEndpoint.test_input_output(NUM) != NUM:
return False
else:
return True
示例13: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
'''
Tests Waldo's ability to propagate an ApplicationException back through an
endpoint call on the remote partner in a sequence. The exception should be
passed back to the root endpoint which initiates the sequence.
Returns true if the exception is caught and handled, and false otherwise.
'''
thrower = Waldo.no_partner_create(Pong,None)
catcher_partner = Waldo.tcp_accept(Pong,HOST,PORT,thrower)
catcher = Waldo.tcp_connect(Ping,HOST,PORT)
return catcher.testExceptionPropagation()
示例14: run_test
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def run_test():
'''
Tests Waldo's ability to propagate an exception back through a sequence within
an endpoint call.
Returns true if the exception is caught and handled, and false otherwise.
'''
Waldo.tcp_accept(Pong,HOST,PORT)
connector = Waldo.tcp_connect(Ping,HOST,PORT)
catcher = Waldo.no_partner_create(Catcher)
catcher.addEndpoint(connector)
return catcher.testCatchApplicationExceptionFromSequence()
示例15: start_coordinator
# 需要导入模块: from waldo.lib import Waldo [as 别名]
# 或者: from waldo.lib.Waldo import no_partner_create [as 别名]
def start_coordinator():
math_endpoint = Waldo.math_endpoint_lib()
coordinator_master = Waldo.no_partner_create(
CoordinatorMaster, util_funcs.between,
util_funcs.rand_uuid,math_endpoint,
conf.MAX_NUMBER_FINGER_TABLE_ENTRIES)
# begin listening for connections to coordinator master
Waldo.tcp_accept(
Coordinator, conf.COORDINATOR_HOST_PORT_PAIR.host,
conf.COORDINATOR_HOST_PORT_PAIR.port, coordinator_master)
return coordinator_master