@@ -2077,27 +2077,34 @@ async def test_turtle(api):
20772077 assert await api .turtle .dropUp () is True
20782078 assert await api .turtle .getItemCount () == 0
20792079
2080- await step (
2081- api ,
2082- 'Clean inventory of turtle\n '
2083- 'Put crafting table into slot 1\n '
2084- 'Put 8 cobblestones into slot 2' ,
2085- )
2080+ async def craft1 ():
2081+ return await api .turtle .craft ()
20862082
2083+ async def craft2 ():
2084+ c = await api .peripheral .wrap ('right' )
2085+ return await c .craft ()
2086+
2087+ await step (api , 'Put crafting table into slot 1' )
20872088 assert await api .turtle .select (1 ) is None
20882089 assert await api .turtle .equipRight () is None
20892090
2090- assert await api .turtle .select (2 ) is None
2091- assert await api .turtle .craft () is False
2092- for idx in [1 , 3 , 5 , 7 , 9 , 10 , 11 ]:
2093- assert await api .turtle .transferTo (idx , 1 )
2094- assert await api .turtle .craft () is True
2095-
2096- assert await api .turtle .select (1 ) is None
2097- assert await api .turtle .getItemDetail (1 ) == {
2098- 'count' : 1 ,
2099- 'name' : 'minecraft:furnace' ,
2100- }
2091+ for craft_fn in craft1 , craft2 :
2092+ await step (
2093+ api ,
2094+ 'Clean inventory of turtle\n '
2095+ 'Put 8 cobblestones into slot 1' ,
2096+ )
2097+
2098+ assert await api .turtle .select (1 ) is None
2099+ assert await craft_fn () is False
2100+ for idx in [2 , 3 , 5 , 7 , 9 , 10 , 11 ]:
2101+ assert await api .turtle .transferTo (idx , 1 )
2102+ assert await craft_fn () is True
2103+ assert await craft_fn () is False
2104+ assert await api .turtle .getItemDetail () == {
2105+ 'count' : 1 ,
2106+ 'name' : 'minecraft:furnace' ,
2107+ }
21012108
21022109 await api .print ('Test finished successfully' )
21032110
0 commit comments