import importlib.util spec=importlib.util.spec_from_file_location('srv','/var/minis/workspace/drinking-games-ui/server.py') srv=importlib.util.module_from_spec(spec); spec.loader.exec_module(srv) room, host=srv.create_room('dice','房主','p-host') for _ in range(2): srv.add_bot(room['code'],'p-host') srv.start_room(room['code'],'p-host') # 上一手飞,叫1必须变斋 room['currentCall']={'count':6,'point':6,'mode':'飞','by':'Mia','byId':'bot'} room['turnIndex']=0 srv.call_dice(room['code'],'p-host',7,1,'斋') print('7x1 zhai', room['currentCall']) assert room['currentCall']['mode']=='斋' # 平斋/切斋后重新按斋规则:7个1斋后,破斋要14个 room['turnIndex']=0 try: srv.call_dice(room['code'],'p-host',13,2,'飞') print('bad break accepted') except Exception as e: print('bad break rejected', str(e)) room['turnIndex']=0 srv.call_dice(room['code'],'p-host',14,2,'飞') print('break after ping zhai ok', room['currentCall']) assert room['currentCall']['mode']=='飞'