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
85ee3e1b
Kaydet (Commit)
85ee3e1b
authored
Şub 04, 2010
tarafından
Ezio Melotti
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use correct assert* methods in the examples.
üst
28c382f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
unittest.rst
Doc/library/unittest.rst
+10
-10
No files found.
Doc/library/unittest.rst
Dosyayı görüntüle @
85ee3e1b
...
...
@@ -121,12 +121,12 @@ Here is a short script to test three functions from the :mod:`random` module::
def test_choice(self):
element = random.choice(self.seq)
self.assert
_(element in
self.seq)
self.assert
In(element,
self.seq)
def test_sample(self):
self.assertRaises(ValueError, random.sample, self.seq, 20)
for element in random.sample(self.seq, 5):
self.assert
_(element in
self.seq)
self.assert
In(element,
self.seq)
if __name__ == '__main__':
unittest.main()
...
...
@@ -307,14 +307,14 @@ us when we run the test::
class DefaultWidgetSizeTestCase(SimpleWidgetTestCase):
def runTest(self):
self.assert
True(self.widget.size() ==
(50,50),
'incorrect default size')
self.assert
Equal(self.widget.size(),
(50,50),
'incorrect default size')
class WidgetResizeTestCase(SimpleWidgetTestCase):
def runTest(self):
self.widget.resize(100,150)
self.assert
True(self.widget.size() ==
(100,150),
'wrong size after resize')
self.assert
Equal(self.widget.size(),
(100,150),
'wrong size after resize')
If the :meth:`~TestCase.setUp` method raises an exception while the test is
running, the framework will consider the test to have suffered an error, and the
...
...
@@ -355,13 +355,13 @@ mechanism::
self.widget = None
def testDefaultSize(self):
self.assert
True(self.widget.size() ==
(50,50),
'incorrect default size')
self.assert
Equal(self.widget.size(),
(50,50),
'incorrect default size')
def testResize(self):
self.widget.resize(100,150)
self.assert
True(self.widget.size() ==
(100,150),
'wrong size after resize')
self.assert
Equal(self.widget.size(),
(100,150),
'wrong size after resize')
Here we have not provided a :meth:`~TestCase.runTest` method, but have instead
provided two different test methods. Class instances will now each run one of
...
...
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