Beispiel #1
0
 def test_lt(self):
     """Verify items can be compared."""
     item1 = MockItem(None, 'path/to/fake1.yml')
     item1.level = (1, 1)
     item2 = MockItem(None, 'path/to/fake1.yml')
     item2.level = (1, 1, 1)
     item3 = MockItem(None, 'path/to/fake1.yml')
     item3.level = (1, 1, 2)
     self.assertLess(item1, item2)
     self.assertLess(item2, item3)
     self.assertGreater(item3, item1)
Beispiel #2
0
 def test_hash(self):
     """Verify items can be hashed."""
     item1 = MockItem(None, 'path/to/fake1.yml')
     item2 = MockItem(None, 'path/to/fake2.yml')
     item3 = MockItem(None, '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))
Beispiel #3
0
 def test_unlink_by_item(self):
     """Verify links can be removed (by item)."""
     path = os.path.join('path', 'to', 'ABC123.yml')
     item = MockItem(None, path)
     self.item.links = ['ABC123']
     self.item.unlink(item)
     self.assertEqual([], self.item.links)
Beispiel #4
0
 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(None, path)
     self.item.link(item)
     self.assertEqual(['ABC123'], self.item.links)
Beispiel #5
0
 def setUp(self):
     path = os.path.join('path', 'to', 'RQ001.yml')
     self.item = MockItem(MockSimpleDocument(), path)
Beispiel #6
0
 def setUp(self):
     path = os.path.join('path', 'to', 'RQ001.yml')
     self.item = MockItem(path)