@@ -1172,43 +1172,50 @@ async def test_monitor_peripheral(api):
11721172 await api .print ('Test finished successfully' )
11731173
11741174
1175- async def test_computer_peripheral (api ):
1175+ async def _computer_peri (api , place_thing , thing ):
11761176 side = 'left'
11771177
11781178 await step (
11791179 api ,
1180- f'Place another computer on { side } side of computer\n '
1180+ f'Place { place_thing } on { side } side of computer\n '
11811181 "Don't turn it on!" ,
11821182 )
11831183
11841184 c = await api .peripheral .wrap (side )
11851185 assert c is not None
11861186
1187- from computercraft .subapis .peripheral import CCComputer
1188-
1187+ from computercraft .subapis .peripheral import ComputerMixin
11891188 tbl = await get_object_table (api , f'peripheral.wrap("{ side } ")' )
1190- assert get_class_table (CCComputer ) == tbl
1189+ assert get_class_table (ComputerMixin ) == tbl
11911190
11921191 assert await c .isOn () is False
11931192 assert isinstance (await c .getID (), int )
11941193 assert await c .getLabel () is None
11951194 assert await c .turnOn () is None
11961195
1197- await step (api , 'Computer must be turned on now' )
1196+ await step (api , f' { thing . capitalize () } must be turned on now' )
11981197
11991198 assert await c .shutdown () is None
12001199
1201- await step (api , 'Computer must shutdown' )
1200+ await step (api , f' { thing . capitalize () } must shutdown' )
12021201
1203- await step (api , 'Now turn on computer manually and enter some commands' )
1202+ await step (api , f 'Now turn on { thing } manually and enter some commands' )
12041203
12051204 assert await c .reboot () is None
12061205
1207- await step (api , 'Computer must reboot' )
1206+ await step (api , f' { thing . capitalize () } must reboot' )
12081207
12091208 await api .print ('Test finished successfully' )
12101209
12111210
1211+ async def test_computer_peripheral (api ):
1212+ await _computer_peri (api , 'another computer' , 'computer' )
1213+
1214+
1215+ async def test_turtle_peripheral (api ):
1216+ await _computer_peri (api , 'turtle' , 'turtle' )
1217+
1218+
12121219async def modem_server (api ):
12131220 side = 'back'
12141221 m = await api .peripheral .wrap (side )
@@ -1463,10 +1470,6 @@ async def test_modem_wrap(api):
14631470 await api .print ('Test finished successfully' )
14641471
14651472
1466- async def test_turtle_peripheral (api ):
1467- raise NotImplementedError
1468-
1469-
14701473async def test_textutils (api ):
14711474 assert await api .textutils .slowWrite ('write ' ) is None
14721475 assert await api .textutils .slowWrite ('write ' , 5 ) is None
0 commit comments