FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/tests/unit/meta/test_abstract_attrs.py at main · netflash/python-gitlab · GitHub
netflash
python-gitlab
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
tests
/
unit
/
meta
/
test_abstract_attrs.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (30 loc) · 1.07 KB
Breadcrumbs
python-gitlab
/
tests
/
unit
/
meta
/
test_abstract_attrs.py
Copy path
File metadata and controls
41 lines (30 loc) · 1.07 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
"""
Ensure that RESTManager subclasses exported to gitlab.v4.objects
are defining the _path and _obj_cls attributes.
Only check using `hasattr` as if incorrect type is assigned the type
checker will raise an error.
"""
from
__future__
import
annotations
from
inspect
import
getmembers
import
gitlab
.
v4
.
objects
from
gitlab
.
base
import
RESTManager
def
test_rest_manager_abstract_attrs
()
->
None
:
without_path
:
list
[
str
]
=
[]
without_obj_cls
:
list
[
str
]
=
[]
for
key
,
member
in
getmembers
(
gitlab
.
v4
.
objects
):
if
not
isinstance
(
member
,
type
):
continue
if
not
issubclass
(
member
,
RESTManager
):
continue
if
not
hasattr
(
member
,
"_path"
):
without_path
.
append
(
key
)
if
not
hasattr
(
member
,
"_obj_cls"
):
without_obj_cls
.
append
(
key
)
assert
not
without_path
, (
"RESTManager subclasses missing '_path' attribute: "
f"
{
', '
.
join
(
without_path
)
}
"
)
assert
not
without_obj_cls
, (
"RESTManager subclasses missing '_obj_cls' attribute: "
f"
{
', '
.
join
(
without_obj_cls
)
}
"
)
Back
|
FazBrowse Home
|
New Git URL