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
e212370f
Kaydet (Commit)
e212370f
authored
Ock 10, 2013
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use correct methods in unittest.mock examples.
üst
d0dfe9ad
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
unittest.mock-examples.rst
Doc/library/unittest.mock-examples.rst
+6
-6
No files found.
Doc/library/unittest.mock-examples.rst
Dosyayı görüntüle @
e212370f
...
@@ -372,8 +372,8 @@ You can stack up multiple patch decorators using this pattern:
...
@@ -372,8 +372,8 @@ You can stack up multiple patch decorators using this pattern:
... @patch('package.module.ClassName1')
... @patch('package.module.ClassName1')
... @patch('package.module.ClassName2')
... @patch('package.module.ClassName2')
... def test_something(self, MockClass2, MockClass1):
... def test_something(self, MockClass2, MockClass1):
... self.assert
True(package.module.ClassName1 is
MockClass1)
... self.assert
Is(package.module.ClassName1,
MockClass1)
... self.assert
True(package.module.ClassName2 is
MockClass2)
... self.assert
Is(package.module.ClassName2,
MockClass2)
...
...
>>> MyTest('test_something').test_something()
>>> MyTest('test_something').test_something()
...
@@ -595,10 +595,10 @@ with `test`:
...
@@ -595,10 +595,10 @@ with `test`:
... class MyTest(TestCase):
... class MyTest(TestCase):
...
...
... def test_one(self, MockSomeClass):
... def test_one(self, MockSomeClass):
... self.assert
True(mymodule.SomeClass is
MockSomeClass)
... self.assert
Is(mymodule.SomeClass,
MockSomeClass)
...
...
... def test_two(self, MockSomeClass):
... def test_two(self, MockSomeClass):
... self.assert
True(mymodule.SomeClass is
MockSomeClass)
... self.assert
Is(mymodule.SomeClass,
MockSomeClass)
...
...
... def not_a_test(self):
... def not_a_test(self):
... return 'something'
... return 'something'
...
@@ -617,7 +617,7 @@ These allow you to move the patching into your `setUp` and `tearDown` methods.
...
@@ -617,7 +617,7 @@ These allow you to move the patching into your `setUp` and `tearDown` methods.
... self.mock_foo = self.patcher.start()
... self.mock_foo = self.patcher.start()
...
...
... def test_foo(self):
... def test_foo(self):
... self.assert
True(mymodule.foo is
self.mock_foo)
... self.assert
Is(mymodule.foo,
self.mock_foo)
...
...
... def tearDown(self):
... def tearDown(self):
... self.patcher.stop()
... self.patcher.stop()
...
@@ -636,7 +636,7 @@ exception is raised in the setUp then tearDown is not called.
...
@@ -636,7 +636,7 @@ exception is raised in the setUp then tearDown is not called.
... self.mock_foo = patcher.start()
... self.mock_foo = patcher.start()
...
...
... def test_foo(self):
... def test_foo(self):
... self.assert
True(mymodule.foo is
self.mock_foo)
... self.assert
Is(mymodule.foo,
self.mock_foo)
...
...
>>> MyTest('test_foo').run()
>>> MyTest('test_foo').run()
...
...
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