Best Python code snippet using Testify_python
SConstruct
Source:SConstruct
...31env.Append(BUILDERS = {32 'build_turtle': Builder(action = 'src/build/publish.py'),33 'build_turtle_cc': Builder(action = 'src/build/turtle-cc.py')34})35env.build_turtle(TTL_OUTPUTS, TTL_INPUTS)36env.build_turtle_cc(CC_TTL_OUTPUTS, CC_TTL_INPUTS)37# Generate www/id/*.jsonld38# ========================39def ttl_scan(node, env, path):40 # When a .jsonld is built from a .ttl file, we need to have access to www/context.jsonld41 return [ env.File('www/context.jsonld') ]42env.Append(SCANNERS = Scanner(function = ttl_scan, skeys = ['.ttl']))43env.Append(BUILDERS = {44 'build_jsonld': Builder(45 action = 'node src/build/publish-json.js www/context.jsonld $SOURCE $TARGET',46 suffix = '.jsonld',47 src_suffix = '.ttl'48 ),49 'build_vocab_jsonld': Builder(...
dragon.py
Source:dragon.py
...34 parser.add_argument('size', type=int, default=5)35 parser.add_argument('angle', type=int, default=90)36 #parser.add_argument('kwargs', type=dict, default={})37 return parser38def build_turtle(color='blue') -> t.Turtle:39 turt = t.Turtle()40 # turt.penup()41 # turt.setx(500)42 # turt.sety(250)43 # turt.pendown()44 turt.color(color)45 turt.speed('fastest')46 return turt47def main():48 parser = build_parser()49 args = parser.parse_args()50 turt = build_turtle()51 draw_curve(turt, args.n_steps, args.size, args.angle)52 t.mainloop()53if __name__ == '__main__':54 main()...
race.py
Source:race.py
1import turtle2import random3screen = turtle.Screen()4screen.setup(width=800, height=600)5x_axis = -3806y_axis = -2107turtle_types = ["red", "green", "purple", "black", "orange", "blue"]8all_turtles = []9is_game_on = False10user_bet = turtle.textinput(title="Make a bet", prompt="Which Turtle will win the race?: ")11for set_turtle in turtle_types:12 build_turtle = turtle.Turtle(shape="turtle")13 build_turtle.penup()14 build_turtle.color(set_turtle)15 build_turtle.goto(x=x_axis, y=y_axis)16 y_axis += 8517 all_turtles.append(build_turtle)18if user_bet:19 is_game_on = True20while is_game_on:21 for turtle in all_turtles:22 if turtle.xcor() > 380: # 380 = (width size for screen / 2) - 2023 is_game_on = False24 winning_color = turtle.pencolor()25 if winning_color == user_bet:26 print(f"You've Won! The {winning_color} Turtle is the winner")27 else:28 print(f"You've Lost! The {winning_color} Turtle is the winner")29 random_distance = random.randint(0, 10)30 turtle.forward(random_distance)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!