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
91795c8e
Kaydet (Commit)
91795c8e
authored
May 09, 2014
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #20776: Flesh out tests for importlib.machinery.PathFinder.
üst
4b8dd71d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
test_path.py
Lib/test/test_importlib/import_/test_path.py
+47
-0
No files found.
Lib/test/test_importlib/import_/test_path.py
Dosyayı görüntüle @
91795c8e
...
...
@@ -112,6 +112,53 @@ class FinderTests:
if
email
is
not
missing
:
sys
.
modules
[
'email'
]
=
email
def
test_finder_with_find_module
(
self
):
class
TestFinder
:
def
find_module
(
self
,
fullname
):
return
self
.
to_return
failing_finder
=
TestFinder
()
failing_finder
.
to_return
=
None
path
=
'testing path'
with
util
.
import_state
(
path_importer_cache
=
{
path
:
failing_finder
}):
self
.
assertIsNone
(
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
]))
success_finder
=
TestFinder
()
success_finder
.
to_return
=
__loader__
with
util
.
import_state
(
path_importer_cache
=
{
path
:
success_finder
}):
spec
=
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
])
self
.
assertEqual
(
spec
.
loader
,
__loader__
)
def
test_finder_with_find_loader
(
self
):
class
TestFinder
:
loader
=
None
portions
=
[]
def
find_loader
(
self
,
fullname
):
return
self
.
loader
,
self
.
portions
path
=
'testing path'
with
util
.
import_state
(
path_importer_cache
=
{
path
:
TestFinder
()}):
self
.
assertIsNone
(
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
]))
success_finder
=
TestFinder
()
success_finder
.
loader
=
__loader__
with
util
.
import_state
(
path_importer_cache
=
{
path
:
success_finder
}):
spec
=
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
])
self
.
assertEqual
(
spec
.
loader
,
__loader__
)
def
test_finder_with_find_spec
(
self
):
class
TestFinder
:
spec
=
None
def
find_spec
(
self
,
fullname
,
target
=
None
):
return
self
.
spec
path
=
'testing path'
with
util
.
import_state
(
path_importer_cache
=
{
path
:
TestFinder
()}):
self
.
assertIsNone
(
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
]))
success_finder
=
TestFinder
()
success_finder
.
spec
=
self
.
machinery
.
ModuleSpec
(
'whatever'
,
__loader__
)
with
util
.
import_state
(
path_importer_cache
=
{
path
:
success_finder
}):
got
=
self
.
machinery
.
PathFinder
.
find_spec
(
'whatever'
,
[
path
])
self
.
assertEqual
(
got
,
success_finder
.
spec
)
Frozen_FinderTests
,
Source_FinderTests
=
util
.
test_both
(
FinderTests
,
importlib
=
importlib
,
machinery
=
machinery
)
...
...
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