Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
4354ba3f
Kaydet (Commit)
4354ba3f
authored
Agu 03, 2004
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
avoid fragility: make sure POSIXLY_CORRECT is completely controlled
for the tests, and restored properly when done
üst
34fba3b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
test_getopt.py
Lib/test/test_getopt.py
+10
-1
No files found.
Lib/test/test_getopt.py
Dosyayı görüntüle @
4354ba3f
...
@@ -16,6 +16,10 @@ def expectException(teststr, expected, failure=AssertionError):
...
@@ -16,6 +16,10 @@ def expectException(teststr, expected, failure=AssertionError):
else
:
else
:
raise
failure
raise
failure
old_posixly_correct
=
os
.
environ
.
get
(
"POSIXLY_CORRECT"
)
if
old_posixly_correct
is
not
None
:
del
os
.
environ
[
"POSIXLY_CORRECT"
]
if
verbose
:
if
verbose
:
print
'Running tests on getopt.short_has_arg'
print
'Running tests on getopt.short_has_arg'
verify
(
getopt
.
short_has_arg
(
'a'
,
'a:'
))
verify
(
getopt
.
short_has_arg
(
'a'
,
'a:'
))
...
@@ -124,7 +128,12 @@ os.environ["POSIXLY_CORRECT"] = "1"
...
@@ -124,7 +128,12 @@ os.environ["POSIXLY_CORRECT"] = "1"
opts
,
args
=
getopt
.
gnu_getopt
(
cmdline
,
'ab:'
,
[
'alpha'
,
'beta='
])
opts
,
args
=
getopt
.
gnu_getopt
(
cmdline
,
'ab:'
,
[
'alpha'
,
'beta='
])
verify
(
opts
==
[(
'-a'
,
''
)])
verify
(
opts
==
[(
'-a'
,
''
)])
verify
(
args
==
[
'arg1'
,
'-b'
,
'1'
,
'--alpha'
,
'--beta=2'
])
verify
(
args
==
[
'arg1'
,
'-b'
,
'1'
,
'--alpha'
,
'--beta=2'
])
del
os
.
environ
[
"POSIXLY_CORRECT"
]
if
old_posixly_correct
is
None
:
del
os
.
environ
[
"POSIXLY_CORRECT"
]
else
:
os
.
environ
[
"POSIXLY_CORRECT"
]
=
old_posixly_correct
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment