FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pymanager/tests/test_pathutils.py at main · python/pymanager · GitHub
python
pymanager
Repository navigation
Code
Issues
24
(24)
Pull requests
6
(6)
Actions
Security and quality
1
(1)
Insights
Expand file tree
Breadcrumbs
pymanager
/
tests
/
test_pathutils.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (43 loc) · 1.41 KB
Breadcrumbs
pymanager
/
tests
/
test_pathutils.py
Copy path
File metadata and controls
51 lines (43 loc) · 1.41 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
import
pytest
from
manage
.
pathutils
import
Path
,
PurePath
,
relative_to
def
test_path_match
():
p
=
Path
(
"python3.12.exe"
)
assert
p
.
match
(
"*.exe"
)
assert
p
.
match
(
"python*"
)
assert
p
.
match
(
"python*.exe"
)
assert
p
.
match
(
"python3.12*.exe"
)
assert
p
.
match
(
"*hon3.*"
)
assert
p
.
match
(
"p*3.*.exe"
)
assert
not
p
.
match
(
"*.com"
)
assert
not
p
.
match
(
"example*"
)
assert
not
p
.
match
(
"example*.com"
)
assert
not
p
.
match
(
"*ple*"
)
def
test_path_stem
():
p
=
Path
(
"python3.12.exe"
)
assert
p
.
stem
==
"python3.12"
assert
p
.
suffix
==
".exe"
p
=
Path
(
"python3.12"
)
assert
p
.
stem
==
"python3"
assert
p
.
suffix
==
".12"
p
=
Path
(
"python3"
)
assert
p
.
stem
==
"python3"
assert
p
.
suffix
==
""
p
=
Path
(
".exe"
)
assert
p
.
stem
==
""
assert
p
.
suffix
==
".exe"
def
test_path_relative_to
():
p
=
Path
(
r"C:\A\B\C\python.exe"
)
actual
=
relative_to
(
p
,
r"C:\A\B\C"
)
assert
isinstance
(
actual
,
Path
)
assert
str
(
actual
)
==
"python.exe"
actual
=
relative_to
(
p
,
"C:
\\
"
)
assert
isinstance
(
actual
,
Path
)
assert
str
(
actual
)
==
r"A\B\C\python.exe"
actual
=
relative_to
(
str
(
p
),
r"C:\A\B"
)
assert
isinstance
(
actual
,
str
)
assert
actual
==
r"C\python.exe"
actual
=
relative_to
(
bytes
(
p
),
r"C:\A\B"
)
assert
isinstance
(
actual
,
bytes
)
assert
actual
==
rb"C\python.exe"
assert
relative_to
(
p
,
r"C:\A\B\C\D"
)
is
p
assert
relative_to
(
p
,
None
)
is
p
Back
|
FazBrowse Home
|
New Git URL