FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
gpython/stdlib/glob/testdata/test.py at main · go-python/gpython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
go-python
/
gpython
Public
Notifications
You must be signed in to change notification settings
Fork
105
Star
1k
Code
Issues
49
Pull requests
5
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
gpython
/
stdlib
/
glob
/
testdata
/
test.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
58 lines (48 loc) · 1.94 KB
Breadcrumbs
gpython
/
stdlib
/
glob
/
testdata
/
test.py
Copy path
File metadata and controls
58 lines (48 loc) · 1.94 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
# Copyright 2022 The go-python Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import
glob
def
norm
(
vs
):
if
len
(
vs
)
==
0
:
return
vs
if
type
(
vs
[
0
])
==
type
(
""
):
return
normStr
(
vs
)
return
normBytes
(
vs
)
def
normStr
(
vs
):
from
os
import
sep
x
=
[]
for
v
in
vs
:
x
.
append
(
v
.
replace
(
'/'
,
sep
))
return
x
def
normBytes
(
vs
):
from
os
import
sep
x
=
[]
for
v
in
vs
:
x
.
append
(
v
.
replace
(
b'/'
,
bytes
(
sep
,
encoding
=
"utf-8"
)))
return
x
def
assertEqual
(
x
,
y
):
xx
=
norm
(
x
)
yy
=
norm
(
y
)
assert
xx
==
yy
,
"got: %s, want: %s"
%
(
repr
(
x
),
repr
(
y
))
## test strings
assertEqual
(
glob
.
glob
(
'*'
), [
"glob.go"
,
"glob_test.go"
,
"testdata"
])
assertEqual
(
glob
.
glob
(
'*test*'
), [
"glob_test.go"
,
"testdata"
])
assertEqual
(
glob
.
glob
(
'*/test*'
), [
"testdata/test.py"
,
"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
'*/test*_*'
), [
"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
'*/t??t*_*'
), [
"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
'*/t[e]?t*_*'
), [
"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
'*/t[oe]?t*_*'
), [
"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
'*/t[o]?t*_*'
), [])
## FIXME(sbinet)
## assertEqual(glob.glob('*/t[!o]?t*_*'), ["testdata/test_golden.txt"])
## test bytes
assertEqual
(
glob
.
glob
(
b'*'
), [
b"glob.go"
,
b"glob_test.go"
,
b"testdata"
])
assertEqual
(
glob
.
glob
(
b'*test*'
), [
b"glob_test.go"
,
b"testdata"
])
assertEqual
(
glob
.
glob
(
b'*/test*'
), [
b"testdata/test.py"
,
b"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
b'*/test*_*'
), [
b"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
b'*/t??t*_*'
), [
b"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
b'*/t[e]?t*_*'
), [
b"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
b'*/t[oe]?t*_*'
), [
b"testdata/test_golden.txt"
])
assertEqual
(
glob
.
glob
(
b'*/t[o]?t*_*'
), [])
## FIXME(sbinet)
## assertEqual(glob.glob(b'*/t[!o]?t*_*'), [b"testdata/test_golden.txt"])
Back
|
FazBrowse Home
|
New Git URL