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
f521b8c6
Kaydet (Commit)
f521b8c6
authored
Mar 26, 2009
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
add much better tests for python version information parsing
üst
c9301355
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
24 deletions
+48
-24
platform.py
Lib/platform.py
+2
-5
test_platform.py
Lib/test/test_platform.py
+46
-19
No files found.
Lib/platform.py
Dosyayı görüntüle @
f521b8c6
...
...
@@ -1264,9 +1264,6 @@ _sys_version_parser = re.compile(
'
\
(#?([^,]+),
\
s*([
\
w ]+),
\
s*([
\
w :]+)
\
)
\
s*'
'
\
[([^
\
]]+)
\
]?'
)
_jython_sys_version_parser
=
re
.
compile
(
r'([\d\.]+)'
)
_ironpython_sys_version_parser
=
re
.
compile
(
r'IronPython\s*'
'([
\
d
\
.]+)'
...
...
@@ -1322,12 +1319,12 @@ def _sys_version(sys_version=None):
elif
sys
.
platform
[:
4
]
==
'java'
:
# Jython
name
=
'Jython'
match
=
_
jython_
sys_version_parser
.
match
(
sys_version
)
match
=
_sys_version_parser
.
match
(
sys_version
)
if
match
is
None
:
raise
ValueError
(
'failed to parse Jython sys.version:
%
s'
%
repr
(
sys_version
))
version
,
=
match
.
groups
()
version
,
buildno
,
builddate
,
buildtime
,
_
=
match
.
groups
()
branch
=
''
revision
=
''
compiler
=
sys
.
platform
...
...
Lib/test/test_platform.py
Dosyayı görüntüle @
f521b8c6
...
...
@@ -48,25 +48,52 @@ class PlatformTest(unittest.TestCase):
def
test_processor
(
self
):
res
=
platform
.
processor
()
def
test_python_implementation
(
self
):
res
=
platform
.
python_implementation
()
def
test_python_version
(
self
):
res1
=
platform
.
python_version
()
res2
=
platform
.
python_version_tuple
()
self
.
assertEqual
(
res1
,
"."
.
join
(
res2
))
def
test_python_branch
(
self
):
res
=
platform
.
python_branch
()
def
test_python_revision
(
self
):
res
=
platform
.
python_revision
()
def
test_python_build
(
self
):
res
=
platform
.
python_build
()
def
test_python_compiler
(
self
):
res
=
platform
.
python_compiler
()
def
setUp
(
self
):
self
.
save_version
=
sys
.
version
self
.
save_subversion
=
sys
.
subversion
self
.
save_platform
=
sys
.
platform
def
tearDown
(
self
):
sys
.
version
=
self
.
save_version
sys
.
subversion
=
self
.
save_subversion
sys
.
platform
=
self
.
save_platform
def
test_python_info
(
self
):
# Tests for python_implementation(), python_version(), python_branch(),
# python_revision(), python_build(), and python_compiler().
sys_versions
=
{
(
"2.6.1 (r261:67515, Dec 6 2008, 15:26:00)
\n
[GCC 4.0.1 (Apple Computer, Inc. build 5370)]"
,
(
'CPython'
,
'tags/r261'
,
'67515'
),
self
.
save_platform
)
:
(
"CPython"
,
"2.6.1"
,
"tags/r261"
,
"67515"
,
(
'r261:67515'
,
'Dec 6 2008 15:26:00'
),
'GCC 4.0.1 (Apple Computer, Inc. build 5370)'
),
(
"IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.3053"
,
None
,
"cli"
)
:
(
"IronPython"
,
"2.0.0"
,
""
,
""
,
(
""
,
""
),
".NET 2.0.50727.3053"
),
(
"2.5 (trunk:6107, Mar 26 2009, 13:02:18)
\n
[Java HotSpot(TM) Client VM (
\"
Apple Computer, Inc.
\"
)]"
,
None
,
"java1.5.0_16"
)
:
(
"Jython"
,
"2.5.0"
,
""
,
""
,
(
""
,
""
),
"java1.5.0_16"
),
}
for
(
version_tag
,
subversion
,
sys_platform
),
info
in
\
sys_versions
.
iteritems
():
sys
.
version
=
version_tag
if
subversion
is
None
:
if
hasattr
(
sys
,
"subversion"
):
del
sys
.
subversion
else
:
sys
.
subversion
=
subversion
if
sys_platform
is
not
None
:
sys
.
platform
=
sys_platform
self
.
assertEqual
(
platform
.
python_implementation
(),
info
[
0
])
self
.
assertEqual
(
platform
.
python_version
(),
info
[
1
])
self
.
assertEqual
(
platform
.
python_branch
(),
info
[
2
])
self
.
assertEqual
(
platform
.
python_revision
(),
info
[
3
])
self
.
assertEqual
(
platform
.
python_build
(),
info
[
4
])
self
.
assertEqual
(
platform
.
python_compiler
(),
info
[
5
])
def
test_system_alias
(
self
):
res
=
platform
.
system_alias
(
...
...
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