本文整理汇总了Python中simulator.Simulator.random_list方法的典型用法代码示例。如果您正苦于以下问题:Python Simulator.random_list方法的具体用法?Python Simulator.random_list怎么用?Python Simulator.random_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulator.Simulator
的用法示例。
在下文中一共展示了Simulator.random_list方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testStandaloneFunctions
# 需要导入模块: from simulator import Simulator [as 别名]
# 或者: from simulator.Simulator import random_list [as 别名]
class testStandaloneFunctions(unittest.TestCase):
def setUp(self):
self.simulator = Simulator()
def test_random_list_should_create_x_amount_reqs(self):
"""Check length of requirements"""
self.simulator.random_list(33)
self.assertEqual(len(self.simulator.requirements),33)
def test_random_list_should_return_list(self):
self.assertIsInstance(self.simulator.requirements, list)
示例2: print_message
# 需要导入模块: from simulator import Simulator [as 别名]
# 或者: from simulator.Simulator import random_list [as 别名]
error_msg_rect = (200,200,active_screen.get_width(),active_screen.get_height())
help_msg_rect = (200,active_screen.get_height()/6,active_screen.get_width(), active_screen.get_width())
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
pos = pygame.mouse.get_pos()
if active_screen == home:
for button in home_men.elements:
if button.clicked(pos):
if button.id == 1:
print_message(message_input_random,help_msg_rect,home)
param_lst = button.executeAction()
if param_lst[0]<0 or param_lst[1]<0:
print_message(["parametros incorrectos"], error_msg_rect, active_screen,(255,0,0))
break
sim.random_list(param_lst[0])
sim.add_random_pf(param_lst[1]+2)
elif button.id == 2:
print_message(message_input_hand,help_msg_rect,home)
sim.requirements = button.executeAction()
elif button.id == 3:
print_message(message_input_file,help_msg_rect,home)
file_name = active_screen.get_element('InputBox').ask(False)
sim.requirements = load_file(file_name)
if (sim.requirements == None):
print_message(["No se pudo abrir el archivo. Revise permisos y/o ubicacion"],error_msg_rect,active_screen,(255,0,0))
break
elif button.id == 4:
print_message(message_input_pos,help_msg_rect,active_screen)
num = active_screen.get_element('InputBox').ask(False)
sim.init_pos = int(num)