FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
GitPython/git/test/lib/asserts.py at master · githubdelegate/GitPython · GitHub
githubdelegate
GitPython
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
GitPython
/
git
/
test
/
lib
/
asserts.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
68 lines (48 loc) · 2 KB
Breadcrumbs
GitPython
/
git
/
test
/
lib
/
asserts.py
Copy path
File metadata and controls
68 lines (48 loc) · 2 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
# asserts.py
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
#
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import
re
import
stat
from
nose
.
tools
import
(
assert_equal
,
assert_not_equal
,
assert_raises
,
raises
,
assert_true
,
assert_false
)
from
mock
import
patch
__all__
=
[
'assert_instance_of'
,
'assert_not_instance_of'
,
'assert_none'
,
'assert_not_none'
,
'assert_match'
,
'assert_not_match'
,
'assert_mode_644'
,
'assert_mode_755'
,
'assert_equal'
,
'assert_not_equal'
,
'assert_raises'
,
'patch'
,
'raises'
,
'assert_true'
,
'assert_false'
]
def
assert_instance_of
(
expected
,
actual
,
msg
=
None
):
"""Verify that object is an instance of expected """
assert
isinstance
(
actual
,
expected
),
msg
def
assert_not_instance_of
(
expected
,
actual
,
msg
=
None
):
"""Verify that object is not an instance of expected """
assert
not
isinstance
(
actual
,
expected
,
msg
)
def
assert_none
(
actual
,
msg
=
None
):
"""verify that item is None"""
assert
actual
is
None
,
msg
def
assert_not_none
(
actual
,
msg
=
None
):
"""verify that item is None"""
assert
actual
is
not
None
,
msg
def
assert_match
(
pattern
,
string
,
msg
=
None
):
"""verify that the pattern matches the string"""
assert_not_none
(
re
.
search
(
pattern
,
string
),
msg
)
def
assert_not_match
(
pattern
,
string
,
msg
=
None
):
"""verify that the pattern does not match the string"""
assert_none
(
re
.
search
(
pattern
,
string
),
msg
)
def
assert_mode_644
(
mode
):
"""Verify given mode is 644"""
assert
(
mode
&
stat
.
S_IROTH
)
and
(
mode
&
stat
.
S_IRGRP
)
assert
(
mode
&
stat
.
S_IWUSR
)
and
(
mode
&
stat
.
S_IRUSR
)
and
not
(
mode
&
stat
.
S_IXUSR
)
def
assert_mode_755
(
mode
):
"""Verify given mode is 755"""
assert
(
mode
&
stat
.
S_IROTH
)
and
(
mode
&
stat
.
S_IRGRP
)
and
(
mode
&
stat
.
S_IXOTH
)
and
(
mode
&
stat
.
S_IXGRP
)
assert
(
mode
&
stat
.
S_IWUSR
)
and
(
mode
&
stat
.
S_IRUSR
)
and
(
mode
&
stat
.
S_IXUSR
)
Back
|
FazBrowse Home
|
New Git URL