def test_changing_tag_to_empty_removes_tag(self): tag = Tag('tag') self.tags.add(tag) self.tags.execute(ChangeTag(tag, '')) self._verify_number_of_tags(1) self._tag_with_name_does_not_exists('tag') self._tag_with_name_exists('')
def test_adding_empty_tag_will_remove_default(self): self.test_default_from_suite() self._verify_number_of_tags(1) t = self.tags.empty_tag() self.tags.execute(ChangeTag(t, '')) self._verify_number_of_tags(1) self._tag_with_name_exists('')
def test_adding_a_tag_to_test_with_a_default_tag(self): test = self._create_test() test.datafile_controller.default_tags.execute(ChangeTag(Tag(None), 'default')) assert_equals([t.name for t in test.tags], ['default']) self._tsc.select(test) self._tsc.add_tag('custom') self.assertEqual([t.name for t in test.tags], ['default', 'custom'])
def test_changing_partial_tag(self): self.tags.add(Tag('tag')) partial = Tag('ag') self.tags.add(partial) self.tags.execute(ChangeTag(partial, 'foo')) self._tag_with_name_exists('foo') self._tag_with_name_exists('tag') self._tag_with_name_does_not_exists('ag')
def test_removing_one_tag_when_multiple_with_same_name(self): name = 'tag' tag = Tag(name) tag2 = Tag(name) self.tags.add(tag) self.tags.add(tag2) self.tags.execute(ChangeTag(tag, '')) self._verify_number_of_tags(1) self._tag_with_name_exists(tag2.name)
def test_changing_tags_does_not_change_total_number_of_tags(self): tag_to_change = Tag('tagistano') self.tags.add(tag_to_change) self._test.datafile_controller.force_tags.add(ForcedTag('suite')) self._test.datafile_controller.parent.force_tags.add( ForcedTag('directory')) self._verify_number_of_tags(3) self._test.tags.execute(ChangeTag(tag_to_change, 'foobar')) self._verify_number_of_tags(3)
def OnRename(self, event): if self._index == -1: return tests,tag_name = self._tags_list.GetClientData(self._index) tags_to_rename = self._tagit[tag_name] name = wx.GetTextFromUser(message="Renaming tag '%s'." % tag_name, default_value=tag_name, caption='Rename') if name: for tag in tags_to_rename: tag.controller.execute(ChangeTag(tag, name)) self._execute() for tag_name, tests in self._results: self.tree.DeselectTests(tests)
def _add_tag(self, test, name): test.tags.execute(ChangeTag(Tag(None), name))
def test_changing_empty_tag_adds_tag(self): name = 'sometag' self.tags.add(Tag('tag')) self.tags.execute(ChangeTag(self.tags.empty_tag(), name)) self._tag_with_name_exists(name)
def test_changing_tag(self): tag = Tag('tag') self.tags.add(tag) self.tags.execute(ChangeTag(tag, 'foo')) self._tag_with_name_exists('foo') assert_false(any(t for t in self.tags if t.name == 'tag'))
def change_value(self, value): if self.modifiable and value != self.text: self._tag.controller.execute(ChangeTag(self._tag, value))