-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix/add tests and behaviour for ancestor annotation and bitmask search.
- Loading branch information
Showing
7 changed files
with
45 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.test import TestCase | ||
from le_utils.constants.labels import learning_activities | ||
|
||
from kolibri.core.content.models import ContentNode | ||
from kolibri.core.content.test.test_channel_upgrade import ChannelBuilder | ||
from kolibri.core.content.utils.search import annotate_label_bitmasks | ||
|
||
|
||
class BitMaskTestCase(TestCase): | ||
def test_ancestors(self): | ||
builder = ChannelBuilder() | ||
builder.insert_into_default_db() | ||
annotate_label_bitmasks(ContentNode.objects.all()) | ||
for la in learning_activities.LEARNINGACTIVITIESLIST: | ||
self.assertEqual( | ||
list(ContentNode.objects.filter(learning_activities__contains=la)), | ||
list(ContentNode.objects.has_all_labels("learning_activities", [la])), | ||
) | ||
print(ContentNode.objects.has_all_labels("learning_activities", [la])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters