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
7995eb22
Kaydet (Commit)
7995eb22
authored
Eki 03, 2002
tarafından
Mark Hammond
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Tests for pep277 - Unicode file names on Windows NT.
üst
ca803a0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
0 deletions
+110
-0
test_pep277
Lib/test/output/test_pep277
+4
-0
test_pep277.py
Lib/test/test_pep277.py
+106
-0
No files found.
Lib/test/output/test_pep277
0 → 100644
Dosyayı görüntüle @
7995eb22
test_pep277
u'F:\\src\\python-cvs\\Lib\\test\\@test\\Gr\xfc\xdf-\u66e8\u66e9\u66eb\\\xdf-\u66e8\u66e9\u66eb'
['???', '???', '??????', '????????????', '????G\xdf', 'Ge??-sa?', 'Gr\xfc\xdf-Gott', 'abc', 'ascii']
[u'Gr\xfc\xdf-Gott', u'abc', u'ascii', u'\u0393\u03b5\u03b9\u03ac-\u03c3\u03b1\u03c2', u'\u0417\u0434\u0440\u0430\u0432\u0441\u0442\u0432\u0443\u0439\u0442\u0435', u'\u05d4\u05e9\u05e7\u05e6\u05e5\u05e1', u'\u306b\u307d\u3093', u'\u66e8\u05e9\u3093\u0434\u0393\xdf', u'\u66e8\u66e9\u66eb']
Lib/test/test_pep277.py
0 → 100644
Dosyayı görüntüle @
7995eb22
# -*- coding: utf-8 -*-
# Test the Unicode versions of normal file functions
# open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir
import
os
,
unittest
from
test.test_support
import
TESTFN
,
TestSkipped
,
TestFailed
,
run_suite
try
:
from
nt
import
_getfullpathname
except
ImportError
:
raise
TestSkipped
,
"test works only on NT"
filenames
=
[
"abc"
,
unicode
(
"ascii"
,
"utf-8"
),
unicode
(
"Grüß-Gott"
,
"utf-8"
),
unicode
(
"Γειά-σας"
,
"utf-8"
),
unicode
(
"Здравствуйте"
,
"utf-8"
),
unicode
(
"にぽん"
,
"utf-8"
),
unicode
(
"השקצץס"
,
"utf-8"
),
unicode
(
"曨曩曫"
,
"utf-8"
),
unicode
(
"曨שんдΓß"
,
"utf-8"
),
]
class
UnicodeFileTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
files
=
[
os
.
path
.
join
(
TESTFN
,
f
)
for
f
in
filenames
]
try
:
os
.
mkdir
(
TESTFN
)
except
OSError
:
pass
for
name
in
self
.
files
:
f
=
open
(
name
,
'w'
)
f
.
write
((
name
+
'
\n
'
)
.
encode
(
"utf-8"
))
f
.
close
()
os
.
stat
(
name
)
def
tearDown
(
self
):
for
name
in
self
.
files
:
os
.
unlink
(
name
)
os
.
rmdir
(
TESTFN
)
def
_apply_failure
(
self
,
fn
,
filename
,
expected_exception
,
check_fn_in_exception
=
True
):
try
:
fn
(
filename
)
raise
TestFailed
(
"Expected to fail calling '
%
s(
%
r)'"
%
(
fn
.
__name__
,
filename
))
except
expected_exception
,
details
:
if
check_fn_in_exception
and
details
.
filename
!=
filename
:
raise
TestFailed
(
"Function '
%
s(
%
r) failed with "
"bad filename in the exception:
%
r"
%
(
fn
.
__name__
,
filename
,
details
.
filename
))
def
test_failures
(
self
):
# Pass non-existing Unicode filenames all over the place.
for
name
in
self
.
files
:
name
=
"not_"
+
name
self
.
_apply_failure
(
open
,
name
,
IOError
)
self
.
_apply_failure
(
os
.
stat
,
name
,
OSError
)
self
.
_apply_failure
(
os
.
chdir
,
name
,
OSError
)
self
.
_apply_failure
(
os
.
rmdir
,
name
,
OSError
)
self
.
_apply_failure
(
os
.
remove
,
name
,
OSError
)
# listdir may append a wildcard to the filename, so dont check
self
.
_apply_failure
(
os
.
listdir
,
name
,
OSError
,
False
)
def
test_open
(
self
):
for
name
in
self
.
files
:
f
=
open
(
name
,
'w'
)
f
.
write
((
name
+
'
\n
'
)
.
encode
(
"utf-8"
))
f
.
close
()
os
.
stat
(
name
)
def
test_listdir
(
self
):
f1
=
os
.
listdir
(
TESTFN
)
f1
.
sort
()
f2
=
os
.
listdir
(
unicode
(
TESTFN
,
"mbcs"
))
f2
.
sort
()
print
f1
print
f2
def
test_rename
(
self
):
for
name
in
self
.
files
:
os
.
rename
(
name
,
"tmp"
)
os
.
rename
(
"tmp"
,
name
)
def
test_directory
(
self
):
dirname
=
unicode
(
os
.
path
.
join
(
TESTFN
,
"Grüß-曨曩曫"
),
"utf-8"
)
filename
=
unicode
(
"ß-曨曩曫"
,
"utf-8"
)
oldwd
=
os
.
getcwd
()
os
.
mkdir
(
dirname
)
os
.
chdir
(
dirname
)
f
=
open
(
filename
,
'w'
)
f
.
write
((
filename
+
'
\n
'
)
.
encode
(
"utf-8"
))
f
.
close
()
print
repr
(
_getfullpathname
(
filename
))
os
.
remove
(
filename
)
os
.
chdir
(
oldwd
)
os
.
rmdir
(
dirname
)
def
test_main
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
UnicodeFileTests
))
run_suite
(
suite
)
if
__name__
==
"__main__"
:
test_main
()
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