diff options
| author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 08:17:32 +0800 |
|---|---|---|
| committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2022-05-18 08:17:32 +0800 |
| commit | 38e9a18b976b2b7e3b3cd0fcd5b037573823d7c2 (patch) | |
| tree | 8ac0bc1540650cf3befff11735e1421de372fa92 /test/test_tree.py | |
| parent | b30720ee4d9762a03eae4fa7cfa4b0190d81784d (diff) | |
| parent | 43c00af7e542911cce638cfab49c6a6dc9349e55 (diff) | |
| download | gitpython-38e9a18b976b2b7e3b3cd0fcd5b037573823d7c2.tar.gz | |
Merge branch 'black-fmt'
Diffstat (limited to 'test/test_tree.py')
| -rw-r--r-- | test/test_tree.py | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/test/test_tree.py b/test/test_tree.py index 24c401cb..22c9c7d7 100644 --- a/test/test_tree.py +++ b/test/test_tree.py @@ -7,10 +7,7 @@ from io import BytesIO from unittest import skipIf -from git.objects import ( - Tree, - Blob -) +from git.objects import Tree, Blob from test.lib import TestBase from git.util import HIDE_WINDOWS_KNOWN_ERRORS @@ -18,22 +15,24 @@ import os.path as osp class TestTree(TestBase): - - @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """ + @skipIf( + HIDE_WINDOWS_KNOWN_ERRORS, + """ File "C:\\projects\\gitpython\\git\\cmd.py", line 559, in execute raise GitCommandNotFound(command, err) git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid') - cmdline: git cat-file --batch-check""") + cmdline: git cat-file --batch-check""", + ) def test_serializable(self): # tree at the given commit contains a submodule as well - roottree = self.rorepo.tree('6c1faef799095f3990e9970bc2cb10aa0221cf9c') + roottree = self.rorepo.tree("6c1faef799095f3990e9970bc2cb10aa0221cf9c") for item in roottree.traverse(ignore_self=False): if item.type != Tree.type: continue # END skip non-trees tree = item # trees have no dict - self.assertRaises(AttributeError, setattr, tree, 'someattr', 1) + self.assertRaises(AttributeError, setattr, tree, "someattr", 1) orig_data = tree.data_stream.read() orig_cache = tree._cache @@ -43,22 +42,25 @@ class TestTree(TestBase): assert stream.getvalue() == orig_data stream.seek(0) - testtree = Tree(self.rorepo, Tree.NULL_BIN_SHA, 0, '') + testtree = Tree(self.rorepo, Tree.NULL_BIN_SHA, 0, "") testtree._deserialize(stream) assert testtree._cache == orig_cache # replaces cache, but we make sure of it - del(testtree._cache) + del testtree._cache testtree._deserialize(stream) # END for each item in tree - @skipIf(HIDE_WINDOWS_KNOWN_ERRORS, """ + @skipIf( + HIDE_WINDOWS_KNOWN_ERRORS, + """ File "C:\\projects\\gitpython\\git\\cmd.py", line 559, in execute raise GitCommandNotFound(command, err) git.exc.GitCommandNotFound: Cmd('git') not found due to: OSError('[WinError 6] The handle is invalid') - cmdline: git cat-file --batch-check""") + cmdline: git cat-file --batch-check""", + ) def test_traverse(self): - root = self.rorepo.tree('0.1.6') + root = self.rorepo.tree("0.1.6") num_recursive = 0 all_items = [] for obj in root.traverse(): @@ -72,7 +74,7 @@ class TestTree(TestBase): # limit recursion level to 0 - should be same as default iteration assert all_items - assert 'CHANGES' in root + assert "CHANGES" in root assert len(list(root)) == len(list(root.traverse(depth=1))) # only choose trees @@ -96,7 +98,7 @@ class TestTree(TestBase): found_slash = False for item in root.traverse(): assert osp.isabs(item.abspath) - if '/' in item.path: + if "/" in item.path: found_slash = True # END check for slash |
