def test_lt(self): """Verify items can be compared.""" item1 = MockItem('path/to/fake1.yml') item1.level = (1, 1) item2 = MockItem('path/to/fake1.yml') item2.level = (1, 1, 1) item3 = MockItem('path/to/fake1.yml') item3.level = (1, 1, 2) self.assertLess(item1, item2) self.assertLess(item2, item3) self.assertGreater(item3, item1)
def test_hash(self): """Verify items can be hashed.""" item1 = MockItem('path/to/fake1.yml') item2 = MockItem('path/to/fake2.yml') item3 = MockItem('path/to/fake2.yml') my_set = set() # Act my_set.add(item1) my_set.add(item2) my_set.add(item3) # Assert self.assertEqual(2, len(my_set))
def test_unlink_by_item(self): """Verify links can be removed (by item).""" path = os.path.join('path', 'to', 'ABC123.yml') item = MockItem(path) self.item.links = ['ABC123'] self.item.unlink(item) self.assertEqual([], self.item.links)
def test_link_by_item(self): """Verify links can be added to an item (by item).""" path = os.path.join('path', 'to', 'ABC123.yml') item = MockItem(path) self.item.link(item) self.assertEqual(['ABC123'], self.item.links)
def setUp(self): path = os.path.join('path', 'to', 'RQ001.yml') self.item = MockItem(path)