Пример #1
0
 def test_remove_items_by_project(self):
     self._init_test_data_file()
     title = "title"
     project = "project"
     item = Item(title, {Elem.PROJECT : project})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.PROJECT, project))
     orgm.remove_items(Elem.PROJECT, project)
     self.assertFalse(orgm.find_items(Elem.PROJECT, project))
Пример #2
0
 def test_remove_items_rgx_by_area(self):
     self._init_test_data_file()
     title = "title"
     area = "area"
     rgx_match = "are*"
     item = Item(title, {Elem.AREA : area})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.AREA, rgx_match, use_regex_match=True))
     orgm.remove_items(Elem.AREA, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.AREA, rgx_match, use_regex_match=True))
Пример #3
0
 def test_remove_items_rgx_by_title(self):
     self._init_test_data_file()
     title = "title"
     rgx_match = "titl*"
     item = Item(title)
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item)
     self.assertTrue(orgm.find_items(Elem.TITLE, rgx_match, use_regex_match=True))
     # NOTE: Now remove the item and check that it's not there any more
     orgm.remove_items(Elem.TITLE, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.TITLE, rgx_match, use_regex_match=True))
Пример #4
0
    def test_remove_items_by_note(self):
        self._init_test_data_file()
        title = "title"
        note = """* Support for reporting on metadata
** all titles (alpha order, due date order)
  ** all projects (alpha order)
    ** all areas (alpha order)
      ** all tags (alpha order)
        ** all actions (grouped by item, item next due date order)
    http://www.snippy.com

    ljalj;
  a             dafs            asdfdsa           wkwjl;qq;q;"""
        item = Item(title, {Elem.NOTE : note})
        orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
        orgm.add_item(item)                
        self.assertTrue(orgm.find_items(Elem.NOTE, note))
        orgm.remove_items(Elem.NOTE, note)        
        self.assertFalse(orgm.find_items(Elem.NOTE, note)) 
Пример #5
0
 def test_remove_items_by_tags(self):
     self._init_test_data_file()
     title = "title"
     tag1 = 'tag 1'
     tags1 = [tag1]
     item1 = Item(title, {Elem.TAGS : tags1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag1))
     orgm.remove_items(Elem.TAGS, tag1)
     self.assertFalse(orgm.find_items(Elem.TAGS, tag1))
     tag2 = 'tag 2'
     tags2 = [tag1, tag2]
     item2 = Item(title, {Elem.TAGS : tags2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.TAGS, tag2))
     self.assertTrue(orgm.find_items(Elem.TAGS, tags2))
     orgm.remove_items(Elem.TAGS, tags2)        
     self.assertFalse(orgm.find_items(Elem.TAGS, tags2))
Пример #6
0
 def test_remove_items_rgx_by_actions(self):
     self._init_test_data_file()
     title = "title"
     action1 = 'action 110'
     rgx_match = "action 11*"
     actions1 = [action1]
     item1 = Item(title, {Elem.ACTIONS : actions1})
     orgm = Organizem(TEST_DATA_FILE, IS_UNIT_TESTING)
     orgm.add_item(item1)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action1))
     orgm.remove_items(Elem.ACTIONS, rgx_match, use_regex_match=True)
     self.assertFalse(orgm.find_items(Elem.ACTIONS, action1))
     action2 = 'action 101'
     rgx_match = "action 10*"
     actions2 = [action1, action2]
     item2 = Item(title, {Elem.ACTIONS : actions2})
     orgm.add_item(item2)
     self.assertTrue(orgm.find_items(Elem.ACTIONS, action2))
     self.assertTrue(orgm.find_items(Elem.ACTIONS, actions2))
     orgm.remove_items(Elem.ACTIONS, rgx_match, use_regex_match=True)        
     self.assertFalse(orgm.find_items(Elem.ACTIONS, actions2))