Ejemplo n.º 1
0
 def test_listsSetIndex_InsertFromStart(self):
     items = ['a', 'b', 'c', 'd']
     BlocklyMethods.listsSetIndex(items, 'insert', 'A', 'from_start', 1)
     self.assertEqual(['a', 'A', 'b', 'c', 'd'], items)
Ejemplo n.º 2
0
 def test_listsSetIndex_SetRandom(self):
     items = ['a', 'b', 'c', 'd']
     BlocklyMethods.listsSetIndex(items, 'set', 'A', 'random')
     self.assertNotEqual(['a', 'b', 'c', 'd'], items)
     self.assertIn('A', items)
Ejemplo n.º 3
0
 def test_listsSetIndex_InsertFirst(self):
     items = ['a', 'b', 'c', 'd']
     BlocklyMethods.listsSetIndex(items, 'insert', 'A', 'first')
     self.assertEqual(['A', 'a', 'b', 'c', 'd'], items)
Ejemplo n.º 4
0
def run():
    global item, item2, item8, item7, item9, item4, item3, item10, item6, item5
    BlocklyMethods.listsSetIndex(item, 'set', 0, 'from_start', 0)
    BlocklyMethods.listsSetIndex(item, 'set', 0, 'from_end', 0)
    BlocklyMethods.listsSetIndex(item, 'set', 0, 'first')
    BlocklyMethods.listsSetIndex(item, 'set', 0, 'last')
    BlocklyMethods.listsSetIndex(item, 'set', 0, 'random')
    BlocklyMethods.listsSetIndex(item, 'insert', 0, 'from_start', 0)
    BlocklyMethods.listsSetIndex(item, 'insert', 0, 'from_end', 0)
    BlocklyMethods.listsSetIndex(item, 'insert', 0, 'first')
    BlocklyMethods.listsSetIndex(item, 'insert', 0, 'last')
    BlocklyMethods.listsSetIndex(item, 'insert', 0, 'random')
    BlocklyMethods.listsSetIndex(item2, 'set', True, 'from_start', 0)
    BlocklyMethods.listsSetIndex(item2, 'set', True, 'from_end', 0)
    BlocklyMethods.listsSetIndex(item2, 'set', True, 'first')
    BlocklyMethods.listsSetIndex(item2, 'set', True, 'last')
    BlocklyMethods.listsSetIndex(item2, 'set', True, 'random')
    BlocklyMethods.listsSetIndex(item2, 'insert', True, 'from_start', 0)
    BlocklyMethods.listsSetIndex(item2, 'insert', True, 'from_end', 0)
    BlocklyMethods.listsSetIndex(item2, 'insert', True, 'first')
    BlocklyMethods.listsSetIndex(item2, 'insert', True, 'last')
    BlocklyMethods.listsSetIndex(item2, 'insert', True, 'random')
    BlocklyMethods.listsSetIndex(item3, 'set', "123", 'from_start', 0)
    BlocklyMethods.listsSetIndex(item3, 'set', "123", 'from_end', 0)
    BlocklyMethods.listsSetIndex(item3, 'set', "123", 'first')
    BlocklyMethods.listsSetIndex(item3, 'set', "123", 'last')
    BlocklyMethods.listsSetIndex(item3, 'set', "123", 'random')
    BlocklyMethods.listsSetIndex(item3, 'insert', "123", 'from_start', 0)
    BlocklyMethods.listsSetIndex(item3, 'insert', "123", 'from_end', 0)
    BlocklyMethods.listsSetIndex(item3, 'insert', "123", 'first')
    BlocklyMethods.listsSetIndex(item3, 'insert', "123", 'last')
    BlocklyMethods.listsSetIndex(item3, 'insert', "123", 'random')
    BlocklyMethods.listsSetIndex(item4, 'set', 'black', 'from_start', 0)
    BlocklyMethods.listsSetIndex(item4, 'set', 'black', 'from_end', 0)
    BlocklyMethods.listsSetIndex(item4, 'set', 'black', 'first')
    BlocklyMethods.listsSetIndex(item4, 'set', 'black', 'last')
    BlocklyMethods.listsSetIndex(item4, 'set', 'black', 'random')
    BlocklyMethods.listsSetIndex(item4, 'insert', 'black', 'from_start', 0)
    BlocklyMethods.listsSetIndex(item4, 'insert', 'black', 'from_end', 0)
    BlocklyMethods.listsSetIndex(item4, 'insert', 'black', 'first')
    BlocklyMethods.listsSetIndex(item4, 'insert', 'black', 'last')
    BlocklyMethods.listsSetIndex(item4, 'insert', 'black', 'random')
    BlocklyMethods.listsSetIndex(item5, 'set', hal.waitForConnection(),
                                 'from_start', 0)
    BlocklyMethods.listsSetIndex(item5, 'set', hal.waitForConnection(),
                                 'from_end', 0)
    BlocklyMethods.listsSetIndex(item5, 'set', hal.waitForConnection(),
                                 'first')
    BlocklyMethods.listsSetIndex(item5, 'set', hal.waitForConnection(), 'last')
    BlocklyMethods.listsSetIndex(item5, 'set', hal.waitForConnection(),
                                 'random')
    BlocklyMethods.listsSetIndex(item5, 'insert', hal.waitForConnection(),
                                 'from_start', 0)
    BlocklyMethods.listsSetIndex(item5, 'insert', hal.waitForConnection(),
                                 'from_end', 0)
    BlocklyMethods.listsSetIndex(item5, 'insert', hal.waitForConnection(),
                                 'first')
    BlocklyMethods.listsSetIndex(item5, 'insert', hal.waitForConnection(),
                                 'last')
    BlocklyMethods.listsSetIndex(item5, 'insert', hal.waitForConnection(),
                                 'random')