@@ -500,24 +500,26 @@ describe("cloning", () => {
500500 } ) ;
501501
502502 [
503- { target : "pytch" , args : "self" } ,
504- { target : "self" , args : "" } ,
503+ { label : "pytch.create_clone_of" , call_code : "pytch.create_clone_of(self)" } ,
504+ { label : "self.create_clone_of" , call_code : "self.create_clone_of(self)" } ,
505+ { label : "self.create_clone" , call_code : "self.create_clone()" } ,
505506 ] . forEach ( spec => {
506- it ( `handles clone of deleted instance with ${ spec . target } ` , async ( ) => {
507+ it ( `handles clone of deleted instance ( ${ spec . label } ) ` , async ( ) => {
507508 const project = await import_deindented ( `
508509
509510 import pytch
510511
511512 class Banana(pytch.Sprite):
512513 @pytch.when_I_receive("go")
513514 def start(self):
514- ${ spec . target } .broadcast("make-clone")
515- ${ spec . target } .broadcast("make-clone")
516- ${ spec . target } .broadcast("make-clone")
515+ # Mixture of pytch and self:
516+ pytch.broadcast("make-clone")
517+ self.broadcast("make-clone")
518+ pytch.broadcast("make-clone")
517519
518520 @pytch.when_I_receive("make-clone")
519521 def make_clone(self):
520- ${ spec . target } .create_clone_of( ${ spec . args } )
522+ ${ spec . call_code }
521523
522524 @pytch.when_I_start_as_a_clone
523525 def delete_self(self):
@@ -528,29 +530,30 @@ describe("cloning", () => {
528530 many_frames ( project , 5 ) ;
529531 } ) ;
530532
531- it ( `handles clone of deleted instance with ${ spec . target } ( simpler)` , async ( ) => {
533+ it ( `handles clone of deleted instance ( ${ spec . label } ; simpler)` , async ( ) => {
532534 const project = await import_deindented ( `
533535
534536 import pytch
535537
536538 class Frog(pytch.Sprite):
537539 @pytch.when_I_receive("go")
538540 def start(self):
539- ${ spec . target } .create_clone_of(${ spec . args } )
540- ${ spec . target } .broadcast_and_wait("1")
541- ${ spec . target } .broadcast_and_wait("2")
541+ # Mixture of pytch and self:
542+ pytch.create_clone_of(self)
543+ self.broadcast_and_wait("1")
544+ pytch.broadcast_and_wait("2")
542545
543546 @pytch.when_I_receive("1")
544547 def step_1a(self):
545548 self.delete_this_clone()
546549
547550 @pytch.when_I_receive("1")
548551 def step_1b(self):
549- ${ spec . target } .create_clone_of( ${ spec . args } )
552+ ${ spec . call_code }
550553
551554 @pytch.when_I_receive("2")
552555 def step_2(self):
553- ${ spec . target } .create_clone_of( ${ spec . args } )
556+ ${ spec . call_code }
554557 ` ) ;
555558
556559 const frog_cls = project . actor_by_class_name ( "Frog" ) ;
0 commit comments