def test_small_armors(self): t1 = Template.fromSMTPL(tpl_dir + 'AAAstandardgrey.smtpl') assert len(t1.blocks) == 1 assert t1.blocks[0].id == 5 t2 = Template.fromSMTPL(tpl_dir + 'AAAbasicgrey.smtpl') assert t2.blocks[0].id == 598 t3 = Template.fromSMTPL(tpl_dir + 'AAApossiblesalvage.smtpl') assert t3.blocks[0].id == 4
def test_save_orientation_data(self): fname = tpl_dir + 'tutorial1.smtpl' saved_name = tpl_dir + 'tutorial1-save.smtpl' t1 = Template.fromSMTPL(fname) t1.save(saved_name) t2 = Template.fromSMTPL(saved_name) os.remove(saved_name) # TODO: # Check to make sure all the wedges have the same orientation # as the original file pass
def test_save_data(self): saved_name = tpl_dir + 'connections/pulse test 5 (saved).smtpl' t1 = Template.fromSMTPL(tpl_dir + 'connections/pulse test 5.smtpl') t1.save(saved_name) t2 = Template.fromSMTPL(saved_name) t1not = t1.get_all_blocks(name="NOT-Signal")[0] t2not = t2.get_all_blocks(name="NOT-Signal")[0] os.remove(saved_name) # Make sure active states on blocks are being saved correctly assert t1not.active == t2not.active assert t1.num_blocks() == t2.num_blocks() # Make sure connections between blocks are saved assert t1.num_connections() == t2.num_connections()
def test_save_new_data(self): saved_name = tpl_dir + 'generate.smtpl' t1 = Template() b1 = Block.from_itemname('Activation Module') b2 = Block(409, posy=1) t1.connect_blocks(b1, b2) t1.add(b1) t1.add(b2) t1.save(saved_name) t2 = Template.fromSMTPL(saved_name) os.remove(saved_name) assert t1.num_blocks() == t2.num_blocks() assert t1.num_connections() == t2.num_connections()
def test_active_states(self): t1 = Template.fromSMTPL(tpl_dir + 'Pulse.smtpl') assert t1.get_all_blocks(name="NOT-Signal")[0].active == True assert len(t1.get_all_blocks(active=False)) == 3
def test_logic_blocks(self): t1 = Template.fromSMTPL(tpl_dir + 'XOR Gate.smtpl') assert t1.num_blocks() == 8