Skip to content

Commit

Permalink
Replace assertEquals by assertSame
Browse files Browse the repository at this point in the history
  • Loading branch information
lehecht committed Aug 20, 2024
1 parent c5fa83b commit ac8859e
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 161 deletions.
40 changes: 20 additions & 20 deletions tests/Console/Commands/GenerateMissingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public function testHandleImageAnnotations()
Bus::fake();
$this->artisan('largo:generate-missing');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a) {
$this->assertEquals($a->image_id, $job->file->id);
$this->assertEquals([$a->id], $job->only);
$this->assertSame($a->image_id, $job->file->id);
$this->assertSame([$a->id], $job->only);

return true;
});
Expand Down Expand Up @@ -55,8 +55,8 @@ public function testHandleVideoAnnotations()
Bus::fake();
$this->artisan('largo:generate-missing');
Bus::assertDispatched(ProcessAnnotatedVideo::class, function ($job) use ($a) {
$this->assertEquals($a->video_id, $job->file->id);
$this->assertEquals([$a->id], $job->only);
$this->assertSame($a->video_id, $job->file->id);
$this->assertSame([$a->id], $job->only);

return true;
});
Expand Down Expand Up @@ -130,7 +130,7 @@ public function testHandleVolume()
Bus::fake();
$this->artisan("largo:generate-missing --volume={$a1->image->volume_id}");
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a1) {
$this->assertEquals($a1->image_id, $job->file->id);
$this->assertSame($a1->image_id, $job->file->id);

return true;
});
Expand Down Expand Up @@ -175,7 +175,7 @@ public function testHandleQueue()
Bus::fake();
$this->artisan('largo:generate-missing --queue=special');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) {
$this->assertEquals('special', $job->queue);
$this->assertSame('special', $job->queue);

return true;
});
Expand All @@ -195,8 +195,8 @@ public function testHandleNewerThan()
Bus::fake();
$this->artisan('largo:generate-missing --newer-than=2024-01-23');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a1) {
$this->assertEquals($a1->image_id, $job->file->id);
$this->assertEquals([$a1->id], $job->only);
$this->assertSame($a1->image_id, $job->file->id);
$this->assertSame([$a1->id], $job->only);

return true;
});
Expand All @@ -216,8 +216,8 @@ public function testHandleOlderThan()
Bus::fake();
$this->artisan('largo:generate-missing --older-than=2024-01-23');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a2) {
$this->assertEquals($a2->image_id, $job->file->id);
$this->assertEquals([$a2->id], $job->only);
$this->assertSame($a2->image_id, $job->file->id);
$this->assertSame([$a2->id], $job->only);

return true;
});
Expand All @@ -234,8 +234,8 @@ public function testHandleSkipVectors()
Bus::fake();
$this->artisan('largo:generate-missing --skip-vectors');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a2) {
$this->assertEquals($a2->image_id, $job->file->id);
$this->assertEquals([$a2->id], $job->only);
$this->assertSame($a2->image_id, $job->file->id);
$this->assertSame([$a2->id], $job->only);
$this->assertTrue($job->skipFeatureVectors);
$this->assertFalse($job->skipPatches);
$this->assertFalse($job->skipSvgs);
Expand All @@ -259,8 +259,8 @@ public function testHandleSkipPatches()
Bus::fake();
$this->artisan('largo:generate-missing --skip-patches');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a2) {
$this->assertEquals($a2->image_id, $job->file->id);
$this->assertEquals([$a2->id], $job->only);
$this->assertSame($a2->image_id, $job->file->id);
$this->assertSame([$a2->id], $job->only);
$this->assertFalse($job->skipFeatureVectors);
$this->assertTrue($job->skipPatches);
$this->assertFalse($job->skipSvgs);
Expand All @@ -284,8 +284,8 @@ public function testHandleSkipSvgs()
Bus::fake();
$this->artisan('largo:generate-missing --skip-svgs');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a2) {
$this->assertEquals($a2->image_id, $job->file->id);
$this->assertEquals([$a2->id], $job->only);
$this->assertSame($a2->image_id, $job->file->id);
$this->assertSame([$a2->id], $job->only);
$this->assertFalse($job->skipFeatureVectors);
$this->assertFalse($job->skipPatches);
$this->assertTrue($job->skipSvgs);
Expand All @@ -311,8 +311,8 @@ public function testHandleMixedPatchesVectors()
Bus::fake();
$this->artisan('largo:generate-missing');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a1, $a2, $a3) {
$this->assertEquals($a1->image_id, $job->file->id);
$this->assertEquals([$a1->id, $a2->id, $a3->id], $job->only);
$this->assertSame($a1->image_id, $job->file->id);
$this->assertSame([$a1->id, $a2->id, $a3->id], $job->only);

return true;
});
Expand All @@ -330,8 +330,8 @@ public function testHandleForceWithVectors()
Bus::fake();
$this->artisan('largo:generate-missing --skip-svgs --skip-patches --force');
Bus::assertDispatched(ProcessAnnotatedImage::class, function ($job) use ($a1) {
$this->assertEquals($a1->image_id, $job->file->id);
$this->assertEquals([$a1->id], $job->only);
$this->assertSame($a1->image_id, $job->file->id);
$this->assertSame([$a1->id], $job->only);
$this->assertFalse($job->skipFeatureVectors);
$this->assertTrue($job->skipPatches);
$this->assertTrue($job->skipSvgs);
Expand Down
52 changes: 26 additions & 26 deletions tests/Jobs/ApplyLargoSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public function testChangedAlreadyExistsImageAnnotations()
$job = new ApplyLargoSession('job_id', $user, $dismissed, $changed, [], [], false);
$job->handle();

$this->assertEquals(1, $a1->labels()->count());
$this->assertEquals($al2->id, $a1->labels()->first()->id);
$this->assertSame(1, $a1->labels()->count());
$this->assertSame($al2->id, $a1->labels()->first()->id);
}

public function testChangedAlreadyExistsVideoAnnotations()
Expand Down Expand Up @@ -79,8 +79,8 @@ public function testChangedAlreadyExistsVideoAnnotations()
$job = new ApplyLargoSession('job_id', $user, [], [], $dismissed, $changed, false);
$job->handle();

$this->assertEquals(1, $a1->labels()->count());
$this->assertEquals($al2->id, $a1->labels()->first()->id);
$this->assertSame(1, $a1->labels()->count());
$this->assertSame($al2->id, $a1->labels()->first()->id);
}

public function testChangedDuplicateImageAnnotations()
Expand All @@ -104,8 +104,8 @@ public function testChangedDuplicateImageAnnotations()
$job = new ApplyLargoSession('job_id', $user, $dismissed, $changed, [], [], false);
$job->handle();

$this->assertEquals(1, $a1->labels()->count());
$this->assertEquals($l2->id, $a1->labels()->first()->label_id);
$this->assertSame(1, $a1->labels()->count());
$this->assertSame($l2->id, $a1->labels()->first()->label_id);
}

public function testChangedDuplicateVideoAnnotations()
Expand All @@ -129,8 +129,8 @@ public function testChangedDuplicateVideoAnnotations()
$job = new ApplyLargoSession('job_id', $user, [], [], $dismissed, $changed, false);
$job->handle();

$this->assertEquals(1, $a1->labels()->count());
$this->assertEquals($l2->id, $a1->labels()->first()->label_id);
$this->assertSame(1, $a1->labels()->count());
$this->assertSame($l2->id, $a1->labels()->first()->label_id);
}

public function testAnnotationMeanwhileDeletedImageAnnotations()
Expand Down Expand Up @@ -162,7 +162,7 @@ public function testAnnotationMeanwhileDeletedImageAnnotations()
$a2->delete();
$job->handle();

$this->assertEquals($l2->id, $a1->labels()->first()->label_id);
$this->assertSame($l2->id, $a1->labels()->first()->label_id);
}

public function testAnnotationMeanwhileDeletedVideoAnnotations()
Expand Down Expand Up @@ -194,7 +194,7 @@ public function testAnnotationMeanwhileDeletedVideoAnnotations()
$a2->delete();
$job->handle();

$this->assertEquals($l2->id, $a1->labels()->first()->label_id);
$this->assertSame($l2->id, $a1->labels()->first()->label_id);
}

public function testLabelMeanwhileDeletedImageAnnotations()
Expand Down Expand Up @@ -227,8 +227,8 @@ public function testLabelMeanwhileDeletedImageAnnotations()
$l2->delete();
$job->handle();

$this->assertEquals($l1->id, $a1->labels()->first()->label_id);
$this->assertEquals($l3->id, $a2->labels()->first()->label_id);
$this->assertSame($l1->id, $a1->labels()->first()->label_id);
$this->assertSame($l3->id, $a2->labels()->first()->label_id);
}

public function testLabelMeanwhileDeletedVideoAnnotations()
Expand Down Expand Up @@ -261,8 +261,8 @@ public function testLabelMeanwhileDeletedVideoAnnotations()
$l2->delete();
$job->handle();

$this->assertEquals($l1->id, $a1->labels()->first()->label_id);
$this->assertEquals($l3->id, $a2->labels()->first()->label_id);
$this->assertSame($l1->id, $a1->labels()->first()->label_id);
$this->assertSame($l3->id, $a2->labels()->first()->label_id);
}

public function testDismissImageAnnotations()
Expand Down Expand Up @@ -339,7 +339,7 @@ public function testChangeOwnImageAnnotations()

// al1 was dismissed and then changed, should have a new annotation label
$this->assertNull($al1->fresh());
$this->assertEquals($l1->id, $annotation->labels()->first()->label_id);
$this->assertSame($l1->id, $annotation->labels()->first()->label_id);
Queue::assertNotPushed(RemoveImageAnnotationPatches::class);
}

Expand All @@ -357,7 +357,7 @@ public function testChangeOwnVideoAnnotations()

// al1 was dismissed and then changed, should have a new annotation label
$this->assertNull($al1->fresh());
$this->assertEquals($l1->id, $annotation->labels()->first()->label_id);
$this->assertSame($l1->id, $annotation->labels()->first()->label_id);
Queue::assertNotPushed(RemoveVideoAnnotationPatches::class);
}

Expand All @@ -378,7 +378,7 @@ public function testChangeOtherImageAnnotations()
// should get a new additional label.
$this->assertNotNull($al1->fresh());
$this->assertNotNull($annotation->fresh());
$this->assertEquals(2, $annotation->labels()->count());
$this->assertSame(2, $annotation->labels()->count());
Queue::assertNotPushed(RemoveImageAnnotationPatches::class);
}

Expand All @@ -399,7 +399,7 @@ public function testChangeOtherVideoAnnotations()
// should get a new additional label.
$this->assertNotNull($al1->fresh());
$this->assertNotNull($annotation->fresh());
$this->assertEquals(2, $annotation->labels()->count());
$this->assertSame(2, $annotation->labels()->count());
Queue::assertNotPushed(RemoveVideoAnnotationPatches::class);
}

Expand All @@ -418,7 +418,7 @@ public function testChangeOtherForceImageAnnotations()

$this->assertNull($al1->fresh());
$this->assertNotNull($annotation->fresh());
$this->assertEquals($l1->id, $annotation->labels()->first()->label_id);
$this->assertSame($l1->id, $annotation->labels()->first()->label_id);
Queue::assertNotPushed(RemoveImageAnnotationPatches::class);
}

Expand All @@ -437,7 +437,7 @@ public function testChangeOtherForceVideoAnnotations()

$this->assertNull($al1->fresh());
$this->assertNotNull($annotation->fresh());
$this->assertEquals($l1->id, $annotation->labels()->first()->label_id);
$this->assertSame($l1->id, $annotation->labels()->first()->label_id);
Queue::assertNotPushed(RemoveVideoAnnotationPatches::class);
}

Expand Down Expand Up @@ -600,8 +600,8 @@ public function testDispatchEventOnSuccess()
$job->handle();

Event::assertDispatched(function (LargoSessionSaved $event) use ($user) {
$this->assertEquals($user->id, $event->user->id);
$this->assertEquals('job_id', $event->id);
$this->assertSame($user->id, $event->user->id);
$this->assertSame('job_id', $event->id);
return true;
});
}
Expand All @@ -623,8 +623,8 @@ public function testDispatchEventOnError()
}

Event::assertDispatched(function (LargoSessionFailed $event) use ($user) {
$this->assertEquals($user->id, $event->user->id);
$this->assertEquals('job_id', $event->id);
$this->assertSame($user->id, $event->user->id);
$this->assertSame('job_id', $event->id);
return true;
});
}
Expand All @@ -647,7 +647,7 @@ public function testChangeImageAnnotationCopyFeatureVector()
$vectors = ImageAnnotationLabelFeatureVector::where('annotation_id', $al1->annotation_id)->get();
$this->assertCount(1, $vectors);
$this->assertNotEquals($al1->id, $vectors[0]->id);
$this->assertEquals($l1->id, $vectors[0]->label_id);
$this->assertSame($l1->id, $vectors[0]->label_id);
$this->assertEquals($vector1->vector, $vectors[0]->vector);
}

Expand All @@ -669,7 +669,7 @@ public function testChangeVideoAnnotationCopyFeatureVector()
$vectors = VideoAnnotationLabelFeatureVector::where('annotation_id', $al1->annotation_id)->get();
$this->assertCount(1, $vectors);
$this->assertNotEquals($al1->id, $vectors[0]->id);
$this->assertEquals($l1->id, $vectors[0]->label_id);
$this->assertSame($l1->id, $vectors[0]->label_id);
$this->assertEquals($vector1->vector, $vectors[0]->vector);
}

Expand Down
10 changes: 5 additions & 5 deletions tests/Jobs/CopyImageAnnotationFeatureVectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public function testHandle()
$vectors = ImageAnnotationLabelFeatureVector::where('annotation_id', $vector->annotation_id)
->orderBy('id', 'asc')->get();
$this->assertCount(2, $vectors);
$this->assertEquals($annotationLabel->id, $vectors[1]->id);
$this->assertEquals($annotationLabel->annotation_id, $vectors[1]->annotation_id);
$this->assertEquals($annotationLabel->label_id, $vectors[1]->label_id);
$this->assertEquals($annotationLabel->label->label_tree_id, $vectors[1]->label_tree_id);
$this->assertEquals($vector->volume_id, $vectors[1]->volume_id);
$this->assertSame($annotationLabel->id, $vectors[1]->id);
$this->assertSame($annotationLabel->annotation_id, $vectors[1]->annotation_id);
$this->assertSame($annotationLabel->label_id, $vectors[1]->label_id);
$this->assertSame($annotationLabel->label->label_tree_id, $vectors[1]->label_tree_id);
$this->assertSame($vector->volume_id, $vectors[1]->volume_id);
$this->assertEquals($vector->vector, $vectors[1]->vector);
}
}
10 changes: 5 additions & 5 deletions tests/Jobs/CopyVideoAnnotationFeatureVectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public function testHandle()
$vectors = VideoAnnotationLabelFeatureVector::where('annotation_id', $vector->annotation_id)
->orderBy('id', 'asc')->get();
$this->assertCount(2, $vectors);
$this->assertEquals($annotationLabel->id, $vectors[1]->id);
$this->assertEquals($annotationLabel->annotation_id, $vectors[1]->annotation_id);
$this->assertEquals($annotationLabel->label_id, $vectors[1]->label_id);
$this->assertEquals($annotationLabel->label->label_tree_id, $vectors[1]->label_tree_id);
$this->assertEquals($vector->volume_id, $vectors[1]->volume_id);
$this->assertSame($annotationLabel->id, $vectors[1]->id);
$this->assertSame($annotationLabel->annotation_id, $vectors[1]->annotation_id);
$this->assertSame($annotationLabel->label_id, $vectors[1]->label_id);
$this->assertSame($annotationLabel->label->label_tree_id, $vectors[1]->label_tree_id);
$this->assertSame($vector->volume_id, $vectors[1]->volume_id);
$this->assertEquals($vector->vector, $vectors[1]->vector);
}
}
Loading

0 comments on commit ac8859e

Please sign in to comment.