FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GitPython/gitdb/gitdb/test/test_base.py at main · gitpython-developers/GitPython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
gitpython-developers
/
GitPython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
989
Star
5.2k
Code
Issues
8
Pull requests
2
Discussions
Actions
Security and quality
34
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
GitPython
/
gitdb
/
gitdb
/
test
/
test_base.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
105 lines (89 loc) · 2.77 KB
Breadcrumbs
GitPython
/
gitdb
/
gitdb
/
test
/
test_base.py
Copy path
File metadata and controls
105 lines (89 loc) · 2.77 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
#
# This module is part of GitDB and is released under
# the New BSD License: https://opensource.org/license/bsd-3-clause/
"""Test for object db"""
from
gitdb
.
test
.
lib
import
(
TestBase
,
DummyStream
,
DeriveTest
,
)
from
gitdb
import
(
OInfo
,
OPackInfo
,
ODeltaPackInfo
,
OStream
,
OPackStream
,
ODeltaPackStream
,
IStream
)
from
gitdb
.
util
import
(
NULL_BIN_SHA
)
from
gitdb
.
typ
import
(
str_blob_type
)
class
TestBaseTypes
(
TestBase
):
def
test_streams
(
self
):
# test info
sha
=
NULL_BIN_SHA
s
=
20
blob_id
=
3
info
=
OInfo
(
sha
,
str_blob_type
,
s
)
assert
info
.
binsha
==
sha
assert
info
.
type
==
str_blob_type
assert
info
.
type_id
==
blob_id
assert
info
.
size
==
s
# test pack info
# provides type_id
pinfo
=
OPackInfo
(
0
,
blob_id
,
s
)
assert
pinfo
.
type
==
str_blob_type
assert
pinfo
.
type_id
==
blob_id
assert
pinfo
.
pack_offset
==
0
dpinfo
=
ODeltaPackInfo
(
0
,
blob_id
,
s
,
sha
)
assert
dpinfo
.
type
==
str_blob_type
assert
dpinfo
.
type_id
==
blob_id
assert
dpinfo
.
delta_info
==
sha
assert
dpinfo
.
pack_offset
==
0
# test ostream
stream
=
DummyStream
()
ostream
=
OStream
(
*
(
info
+
(
stream
, )))
assert
ostream
.
stream
is
stream
ostream
.
read
(
15
)
stream
.
_assert
()
assert
stream
.
bytes
==
15
ostream
.
read
(
20
)
assert
stream
.
bytes
==
20
# test packstream
postream
=
OPackStream
(
*
(
pinfo
+
(
stream
, )))
assert
postream
.
stream
is
stream
postream
.
read
(
10
)
stream
.
_assert
()
assert
stream
.
bytes
==
10
# test deltapackstream
dpostream
=
ODeltaPackStream
(
*
(
dpinfo
+
(
stream
, )))
assert
dpostream
.
stream
is
stream
dpostream
.
read
(
5
)
stream
.
_assert
()
assert
stream
.
bytes
==
5
# derive with own args
DeriveTest
(
sha
,
str_blob_type
,
s
,
stream
,
'mine'
,
myarg
=
3
).
_assert
()
# test istream
istream
=
IStream
(
str_blob_type
,
s
,
stream
)
assert
istream
.
binsha
==
None
istream
.
binsha
=
sha
assert
istream
.
binsha
==
sha
assert
len
(
istream
.
binsha
)
==
20
assert
len
(
istream
.
hexsha
)
==
40
assert
istream
.
size
==
s
istream
.
size
=
s
*
2
assert
istream
.
size
==
s
*
2
assert
istream
.
type
==
str_blob_type
istream
.
type
=
"something"
assert
istream
.
type
==
"something"
assert
istream
.
stream
is
stream
istream
.
stream
=
None
assert
istream
.
stream
is
None
assert
istream
.
error
is
None
istream
.
error
=
Exception
()
assert
isinstance
(
istream
.
error
,
Exception
)
Back
|
FazBrowse Home
|
New Git URL