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
0a49c58f
Kaydet (Commit)
0a49c58f
authored
Tem 19, 2009
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Update importlib.test.source.test_abc_loader to new features added in Python 3.1.
üst
9ab0731f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
test_abc_loader.py
Lib/importlib/test/source/test_abc_loader.py
+19
-17
No files found.
Lib/importlib/test/source/test_abc_loader.py
Dosyayı görüntüle @
0a49c58f
...
@@ -183,7 +183,8 @@ class PyLoaderTests(testing_abc.LoaderTests):
...
@@ -183,7 +183,8 @@ class PyLoaderTests(testing_abc.LoaderTests):
mock
.
source
=
b
"1/0"
mock
.
source
=
b
"1/0"
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
):
sys
.
modules
[
name
]
=
module
sys
.
modules
[
name
]
=
module
self
.
assertRaises
(
ZeroDivisionError
,
mock
.
load_module
,
name
)
with
self
.
assertRaises
(
ZeroDivisionError
):
mock
.
load_module
(
name
)
self
.
assertTrue
(
sys
.
modules
[
name
]
is
module
)
self
.
assertTrue
(
sys
.
modules
[
name
]
is
module
)
self
.
assertTrue
(
hasattr
(
module
,
'blah'
))
self
.
assertTrue
(
hasattr
(
module
,
'blah'
))
return
mock
return
mock
...
@@ -193,7 +194,8 @@ class PyLoaderTests(testing_abc.LoaderTests):
...
@@ -193,7 +194,8 @@ class PyLoaderTests(testing_abc.LoaderTests):
mock
=
self
.
mocker
({
name
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
)})
mock
=
self
.
mocker
({
name
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
)})
mock
.
source
=
b
"1/0"
mock
.
source
=
b
"1/0"
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
):
self
.
assertRaises
(
ZeroDivisionError
,
mock
.
load_module
,
name
)
with
self
.
assertRaises
(
ZeroDivisionError
):
mock
.
load_module
(
name
)
self
.
assertTrue
(
name
not
in
sys
.
modules
)
self
.
assertTrue
(
name
not
in
sys
.
modules
)
return
mock
return
mock
...
@@ -207,14 +209,14 @@ class PyLoaderInterfaceTests(unittest.TestCase):
...
@@ -207,14 +209,14 @@ class PyLoaderInterfaceTests(unittest.TestCase):
# No source path should lead to ImportError.
# No source path should lead to ImportError.
name
=
'mod'
name
=
'mod'
mock
=
PyLoaderMock
({})
mock
=
PyLoaderMock
({})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
test_source_path_is_None
(
self
):
def
test_source_path_is_None
(
self
):
name
=
'mod'
name
=
'mod'
mock
=
PyLoaderMock
({
name
:
None
})
mock
=
PyLoaderMock
({
name
:
None
})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
class
PyLoaderGetSourceTests
(
unittest
.
TestCase
):
class
PyLoaderGetSourceTests
(
unittest
.
TestCase
):
...
@@ -349,17 +351,17 @@ class BadBytecodeFailureTests(unittest.TestCase):
...
@@ -349,17 +351,17 @@ class BadBytecodeFailureTests(unittest.TestCase):
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
),
'mod'
),
'magic'
:
bad_magic
}})
'magic'
:
bad_magic
}})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
test_bad_bytecode
(
self
):
def
test_bad_bytecode
(
self
):
# Bad code object bytecode should
el
ad to an ImportError.
# Bad code object bytecode should
le
ad to an ImportError.
name
=
'mod'
name
=
'mod'
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
),
'mod'
),
'bc'
:
b
''
}})
'bc'
:
b
''
}})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
raise_ImportError
(
*
args
,
**
kwargs
):
def
raise_ImportError
(
*
args
,
**
kwargs
):
...
@@ -387,16 +389,16 @@ class MissingPathsTests(unittest.TestCase):
...
@@ -387,16 +389,16 @@ class MissingPathsTests(unittest.TestCase):
# If all *_path methods return None, raise ImportError.
# If all *_path methods return None, raise ImportError.
name
=
'mod'
name
=
'mod'
mock
=
PyPycLoaderMock
({
name
:
None
})
mock
=
PyPycLoaderMock
({
name
:
None
})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
test_source_path_ImportError
(
self
):
def
test_source_path_ImportError
(
self
):
# An ImportError from source_path should trigger an ImportError.
# An ImportError from source_path should trigger an ImportError.
name
=
'mod'
name
=
'mod'
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
mock
=
PyPycLoaderMock
({},
{
name
:
{
'path'
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
)}})
'mod'
)}})
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
test_bytecode_path_ImportError
(
self
):
def
test_bytecode_path_ImportError
(
self
):
# An ImportError from bytecode_path should trigger an ImportError.
# An ImportError from bytecode_path should trigger an ImportError.
...
@@ -404,8 +406,8 @@ class MissingPathsTests(unittest.TestCase):
...
@@ -404,8 +406,8 @@ class MissingPathsTests(unittest.TestCase):
mock
=
PyPycLoaderMock
({
name
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
)})
mock
=
PyPycLoaderMock
({
name
:
os
.
path
.
join
(
'path'
,
'to'
,
'mod'
)})
bad_meth
=
types
.
MethodType
(
raise_ImportError
,
mock
)
bad_meth
=
types
.
MethodType
(
raise_ImportError
,
mock
)
mock
.
bytecode_path
=
bad_meth
mock
.
bytecode_path
=
bad_meth
with
util
.
uncache
(
name
):
with
util
.
uncache
(
name
)
,
self
.
assertRaises
(
ImportError
)
:
self
.
assertRaises
(
ImportError
,
mock
.
load_module
,
name
)
mock
.
load_module
(
name
)
def
test_main
():
def
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