FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GitPython/test/test_blob_filter.py at gix-backend · gitpython-developers/GitPython · GitHub
gitpython-developers
GitPython
Repository navigation
Code
Issues
6
(6)
Pull requests
Discussions
Actions
Security and quality
42
(42)
Insights
Expand file tree
Breadcrumbs
GitPython
/
test
/
test_blob_filter.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (27 loc) · 1.04 KB
Breadcrumbs
GitPython
/
test
/
test_blob_filter.py
Copy path
File metadata and controls
36 lines (27 loc) · 1.04 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# This module is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
"""Tests for the blob filter."""
from
pathlib
import
Path
from
typing
import
Sequence
,
Tuple
import
pytest
from
git
.
index
.
typ
import
BlobFilter
,
StageType
from
git
.
objects
import
Blob
from
git
.
types
import
PathLike
@
pytest
.
mark
.
parametrize
(
"paths, path, expected_result"
,
[
((
Path
(
"foo"
),),
Path
(
"foo"
),
True
),
((
Path
(
"foo"
),),
Path
(
"foo/bar"
),
True
),
((
Path
(
"foo/bar"
),),
Path
(
"foo"
),
False
),
((
Path
(
"foo"
),
Path
(
"bar"
)),
Path
(
"foo"
),
True
),
],
)
def
test_blob_filter
(
paths
:
Sequence
[
PathLike
],
path
:
PathLike
,
expected_result
:
bool
)
->
None
:
"""Test the blob filter."""
blob_filter
=
BlobFilter
(
paths
)
binsha
=
b"a"
*
20
stage_type
:
StageType
=
0
blob
:
Blob
=
Blob
(
repo
=
None
,
binsha
=
binsha
,
path
=
path
)
# type: ignore[arg-type]
stage_blob
:
Tuple
[
StageType
,
Blob
]
=
(
stage_type
,
blob
)
result
=
blob_filter
(
stage_blob
)
assert
result
==
expected_result
Back
|
FazBrowse Home
|
New Git URL