Exemple #1
0
 def __init__(self, component_manager, id=None):
     Criterion.__init__(self, component_manager, id)
     # (card_type.id, fact_view.id):
     self.deactivated_card_type_fact_view_ids = set()
     # We work with _ids instead of ids for speed.
     self._tag_ids_active = set()
     self._tag_ids_forbidden = set()
Exemple #2
0
 def __init__(self, component_manager, id=None):
     Criterion.__init__(self, component_manager, id)
     self.threshold = 5
Exemple #3
0
    def test_empty_criterion(self):
        c = Criterion(self.mnemosyne.component_manager)
        assert c.is_empty() == False

        tag_id = self.database().get_or_create_tag_with_name("a")._id

        c = DefaultCriterion(self.mnemosyne.component_manager)
        for card_type in self.card_types():
            for fact_view in card_type.fact_views:
                c.deactivated_card_type_fact_view_ids.add(
                    (card_type.id, fact_view.id))
        c._tag_ids_active = set([])
        c._tag_ids_forbidden = set()
        assert c.is_empty() == True

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set([])
        c._tag_ids_forbidden = set()
        assert c.is_empty() == True

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set(["__UNTAGGED__"])
        c._tag_ids_forbidden = set([tag_id])
        assert c.is_empty() == False

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set(["__UNTAGGED__"])
        c._tag_ids_forbidden = set([tag_id, "__UNTAGGED__"])
        assert c.is_empty() == True
Exemple #4
0
 def __init__(self, component_manager, id=None):
     Criterion.__init__(self, component_manager, id)
     self.threshold = 5
    def test_empty_criterion(self):
        c = Criterion(self.mnemosyne.component_manager)
        assert c.is_empty() == False

        tag_id = self.database().get_or_create_tag_with_name("a")._id

        c = DefaultCriterion(self.mnemosyne.component_manager)
        for card_type in self.card_types():
            for fact_view in card_type.fact_views:
                c.deactivated_card_type_fact_view_ids.add((card_type.id, fact_view.id))
        c._tag_ids_active = set([])
        c._tag_ids_forbidden = set()
        assert c.is_empty() == True

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set([])
        c._tag_ids_forbidden = set()
        assert c.is_empty() == True

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set(["__UNTAGGED__"])
        c._tag_ids_forbidden = set([tag_id])
        assert c.is_empty() == False

        c = DefaultCriterion(self.mnemosyne.component_manager)
        c.deactivated_card_type_fact_view_ids = set()
        c._tag_ids_active = set(["__UNTAGGED__"])
        c._tag_ids_forbidden = set([tag_id, "__UNTAGGED__"])
        assert c.is_empty() == True