def test_visitSetPenSizeTo(self): context = create_block_context("pen_setPenSizeTo") testblock = context.block addInputOfType(testblock, "SIZE", LiteralType.INT) converted_block = visitBlock(context) assert converted_block[0] == "penSize:" assert converted_block[1] == 1234
def test_visitStop(self): context = create_block_context("control_stop") testblock = context.block testblock.fields["STOP_OPTION"] = ["stopthisscript"] converted_block = visitBlock(context) assert converted_block[0] == "stopScripts" assert converted_block[1] == "stopthisscript"
def test_visitSetPenColorToColor(self): context = create_block_context("pen_setPenColorToColor") testblock = context.block addInputOfType(testblock, "COLOR", LiteralType.STRING) converted_block = visitBlock(context) assert converted_block[0] == "penColor:" assert converted_block[1] == "teststring"
def test_visitLengthoflist(self): context = create_block_context("data_lengthoflist") testblock = context.block testblock.fields["LIST"] = ["testlist"] converted_block = visitBlock(context) assert converted_block[0] == "lineCountOfList:" assert converted_block[1] == "testlist"
def test_visitContentsoflist(self): context = create_block_context("data_contentsoflist") testblock = context.block testblock.fields["LIST"] = ["testlist"] converted_block = visitBlock(context) assert converted_block[0] == "contentsOfList:" assert converted_block[1] == "testlist"
def test_visitUsername(self): context = create_block_context("sensing_username") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "getUserName"
def test_visitHidevariable(self): context = create_block_context("data_hidevariable") testblock = context.block testblock.fields["VARIABLE"] = ["testvar"] converted_block = visitBlock(context) assert converted_block[0] == "hideVariable:" assert converted_block[1] == "testvar"
def test_visitMousey(self): context = create_block_context("sensing_mousey") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "mouseY"
def test_visitTimer(self): context = create_block_context("sensing_timer") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "timer"
def test_visitDayssince2000(self): context = create_block_context("sensing_dayssince2000") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "timestamp"
def test_visitSetvolumeto(self): context = create_block_context("sound_setvolumeto") testblock = context.block addInputOfType(testblock, "VOLUME", LiteralType.INT) converted_block = visitBlock(context) assert converted_block[0] == "setVolumeTo:" assert converted_block[1] == 1234.0
def test_visitGoforwardbackwardlayers(self): context = create_block_context("looks_goforwardbackwardlayers") testblock = context.block testblock.fields["FORWARD_BACKWARD"] = ["forward"] addInputOfType(testblock, "NUM", LiteralType.INT) converted_block = visitBlock(context) assert converted_block[0] == "goBackByLayers:"
def test_visitChangePenSizeBy(self): context = create_block_context("pen_changePenSizeBy") testblock = context.block addInputOfType(testblock, "SIZE", LiteralType.INT) converted_block = visitBlock(context) assert converted_block[0] == "changePenSizeBy:" assert converted_block[1] == 1234
def test_visitDirection(self): context = create_block_context("motion_direction") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "heading"
def test_visitChangevolumeby(self): context = create_block_context("sound_changevolumeby") testblock = context.block addInputOfType(testblock, "VOLUME", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "changeVolumeBy:" assert converted_block[1] == 1234.0
def test_visitSetvolumeto(self): context = create_block_context("sound_setvolumeto") testblock = context.block addInputOfType(testblock, "VOLUME", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "setVolumeTo:" assert converted_block[1] == 1234.0
def test_visitPlayuntildone(self): context = create_block_context("sound_playuntildone") testblock = context.block self.add_menu_block(context, "sound_sounds_menu", "SOUND_MENU", "test_sound") converted_block = visitBlock(context) assert converted_block[0] == "doPlaySoundAndWait" assert converted_block[1] == "test_sound"
def test_visitYposition(self): context = create_block_context("motion_yposition") testblock = context.block converted_block = visitBlock(context) assert converted_block[0] == "ypos"
def test_visitGoforwardbackwardlayers(self): context = create_block_context("looks_goforwardbackwardlayers") testblock = context.block testblock.fields["FORWARD_BACKWARD"] = ["forward"] addInputOfType(testblock, "NUM", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "goBackByLayers:"
def test_showSpriteBlock(self): context = create_block_context("show") testblock = context.block addInputToBlock(testblock,"myval", 1) converted_block = visitBlock(context) assert converted_block
def test_visitSetdragmode(self): context = create_block_context("sensing_setdragmode") testblock = context.block testblock.fields["DRAG_MODE"] = ["mode"] converted_block = visitBlock(context) assert converted_block[0] == "dragMode" assert converted_block[1] == "mode"
def test_visitChangeyby(self): context = create_block_context("motion_changeyby") testblock = context.block addInputOfType(testblock, "DY", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "changeYposBy:" assert converted_block[1] == 1234
def test_visitPointtowards(self): context = create_block_context("motion_pointtowards") testblock = context.block addInputOfType(testblock, "TOWARDS", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "pointTowards:" assert converted_block[1] == 1234
def test_visitPointindirection(self): context = create_block_context("motion_pointindirection") testblock = context.block addInputOfType(testblock, "DIRECTION", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "heading:" assert converted_block[1] == 1234
def test_visitGoto(self): context = create_block_context("motion_goto") testblock = context.block addInputOfType(testblock, "TO", TYPE_STRING) converted_block = visitBlock(context) assert converted_block[0] == "gotoSpriteOrMouse:" assert converted_block[1] == "teststring"
def test_visitTurnleft(self): context = create_block_context("motion_turnleft") testblock = context.block addInputOfType(testblock, "DEGREES", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "turnLeft:" assert converted_block[1] == 1234
def test_visitMovesteps(self): context = create_block_context("motion_movesteps") testblock = context.block addInputOfType(testblock, "STEPS", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "forward:" assert converted_block[1] == 1234
def test_visitThink(self): context = create_block_context("looks_think") testblock = context.block addInputOfType(testblock, "MESSAGE", TYPE_STRING) converted_block = visitBlock(context) assert converted_block[0] == "think:" assert converted_block[1] == "teststring"
def test_visitSetsizeto(self): context = create_block_context("looks_setsizeto") testblock = context.block addInputOfType(testblock, "SIZE", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "setSizeTo:" assert converted_block[1] == 1234.0
def test_visitSety(self): context = create_block_context("motion_sety") testblock = context.block addInputOfType(testblock, "Y", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "ypos:" assert converted_block[1] == 1234
def test_visitWait(self): context = create_block_context("control_wait") testblock = context.block addInputOfType(testblock, "DURATION", TYPE_INT) addInputOfType(testblock, "SUBSTACK", TYPE_BLOCK) converted_block = visitBlock(context) assert converted_block[0] == "wait:elapsed:from:" assert converted_block[1] == 1234
def test_visitChangesizeby(self): context = create_block_context("looks_changesizeby") testblock = context.block addInputOfType(testblock, "CHANGE", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "changeSizeBy:" assert converted_block[1] == 1234.0
def test_visitTurnright(self): context = create_block_context("motion_turnright") testblock = context.block addInputOfType(testblock, "DEGREES", LiteralType.INT) converted_block = visitBlock(context) assert converted_block[0] == "turnRight:" assert converted_block[1] == 1234
def test_visitGt(self): context = create_block_context("operator_gt") testblock = context.block addInputOfType(testblock, "OPERAND1", TYPE_INT) addInputOfType(testblock, "OPERAND2", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == ">" assert converted_block[1] == 1234 assert converted_block[2] == 1234
def test_visitJoin(self): context = create_block_context("operator_join") testblock = context.block addInputOfType(testblock, "STRING1", TYPE_STRING) addInputOfType(testblock, "STRING2", TYPE_STRING) converted_block = visitBlock(context) assert converted_block[0] == "concatenate:with:" assert converted_block[1] == "teststring" assert converted_block[2] == "teststring"
def test_visitSubtract(self): context = create_block_context("operator_subtract") testblock = context.block addInputOfType(testblock, "NUM1", TYPE_INT) addInputOfType(testblock, "NUM2", TYPE_INT) converted_block = visitBlock(context) assert converted_block[0] == "-" assert converted_block[1] == 1234 assert converted_block[2] == 1234