def run(): global item, item2, item7, item4, item3, item6, item5 item = BlocklyMethods.createListWithItem(0, 5) item2 = BlocklyMethods.createListWithItem(True, 5) item3 = BlocklyMethods.createListWithItem("", 5) item4 = BlocklyMethods.createListWithItem('white', 5) item5 = BlocklyMethods.createListWithItem(hal.waitForConnection(), 5) item = BlocklyMethods.listsGetSubList(item, 'from_start', 0, 'from_start', 0) item2 = BlocklyMethods.listsGetSubList(item2, 'from_start', 0, 'from_start', 0) item3 = BlocklyMethods.listsGetSubList(item3, 'from_start', 0, 'from_start', 0) item4 = BlocklyMethods.listsGetSubList(item4, 'from_start', 0, 'from_start', 0) item5 = BlocklyMethods.listsGetSubList(item5, 'from_start', 0, 'from_start', 0) item6 = BlocklyMethods.findFirst(item, 0) item6 = BlocklyMethods.findFirst(item2, True) item6 = BlocklyMethods.findFirst(item3, "") item6 = BlocklyMethods.findFirst(item4, 'white') item6 = BlocklyMethods.findFirst(item5, hal.waitForConnection()) item6 = BlocklyMethods.findLast(item, 0) item6 = BlocklyMethods.findLast(item2, True) item6 = BlocklyMethods.findLast(item3, "") item6 = BlocklyMethods.findLast(item4, 'white') item6 = BlocklyMethods.findLast(item5, hal.waitForConnection())
def test_listsGetSubList_Last(self): sub = BlocklyMethods.listsGetSubList(['a', 'b', 'c', 'd'], 'last', None, 'last', None) self.assertEqual(['d'], sub)
def test_listsGetSubList_FromEnd(self): sub = BlocklyMethods.listsGetSubList(['a', 'b', 'c', 'd'], 'from_end', 2, 'from_end', 1) self.assertEqual(['b', 'c'], sub)
def test_listsGetSubList_FromStart(self): sub = BlocklyMethods.listsGetSubList(['a', 'b', 'c', 'd'], 'from_start', 1, 'from_start', 2) self.assertEqual(['b', 'c'], sub)