Index: add failing tests for a standalone Index
The index can exist purely as a data structure. Let's test that so we make sure we support that.
This commit is contained in:
@@ -34,7 +34,7 @@ import unittest
|
|||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import pygit2
|
import pygit2
|
||||||
from pygit2 import Repository
|
from pygit2 import Repository, Index
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
@@ -206,5 +206,19 @@ class IndexEntryTest(utils.RepoTestCase):
|
|||||||
tree_id = index.write_tree()
|
tree_id = index.write_tree()
|
||||||
self.assertEqual('60e769e57ae1d6a2ab75d8d253139e6260e1f912', str(tree_id))
|
self.assertEqual('60e769e57ae1d6a2ab75d8d253139e6260e1f912', str(tree_id))
|
||||||
|
|
||||||
|
class StandaloneIndexTest(utils.RepoTestCase):
|
||||||
|
|
||||||
|
def test_create_empty(self):
|
||||||
|
index = Index()
|
||||||
|
|
||||||
|
def test_create_empty_read_tree_as_string(self):
|
||||||
|
index = Index()
|
||||||
|
# no repo associated, so we don't know where to read from
|
||||||
|
self.assertRaises(TypeError, index, 'read_tree', 'fd937514cb799514d4b81bb24c5fcfeb6472b245')
|
||||||
|
|
||||||
|
def test_create_empty_read_tree(self):
|
||||||
|
index = Index()
|
||||||
|
index.read_tree(self.repo['fd937514cb799514d4b81bb24c5fcfeb6472b245'])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user