homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author moormaster
Recipients Julian, Miklós.Fazekas, Yaroslav.Halchenko, abingham, bfroehle, borja.ruiz, chris.jerdonek, eric.araujo, eric.snow, exarkun, ezio.melotti, fperez, hpk, kynan, martin.panter, michael.foord, moormaster, nchauvat, ncoghlan, pitrou, r.david.murray, santoso.wijaya, spiv, terry.reedy, zach.ware
Date 2019年09月20日.19:18:32
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569007112.64.0.317708621569.issue7897@roundup.psfhosted.org>
In-reply-to
Content
+1 for the feature
Subtests make the test results of all asserts visible at test execution time but decrease the readability of a test:
@parameterized([2,4,6])
def test_method_whenCalled_returnsNone(self, a):
 # 1) arrange
 something = Something()
 # 2) act
 result = something.method(a)
 # 3) assert
 self.assertIsNone(result)
When using subtests the phases of 1) arrange, 2) act, 3) assert are not clearly separated, the unit test contains logic and two additional indentation levels that could be avoided with parameterized tests:
def test_method_whenCalled_returnsNone(self, a):
 # 1) arrange
 something = Something()
 for a in [2,4,6]:
 with self.subTest(a=a):
 # 2) act
 result = something.method(a)
 # 3) assert
 self.assertIsNone(result)
History
Date User Action Args
2019年09月20日 19:18:32moormastersetrecipients: + moormaster, terry.reedy, spiv, exarkun, ncoghlan, pitrou, ezio.melotti, eric.araujo, r.david.murray, michael.foord, hpk, fperez, chris.jerdonek, Yaroslav.Halchenko, santoso.wijaya, nchauvat, kynan, Julian, abingham, eric.snow, martin.panter, zach.ware, borja.ruiz, bfroehle, Miklós.Fazekas
2019年09月20日 19:18:32moormastersetmessageid: <1569007112.64.0.317708621569.issue7897@roundup.psfhosted.org>
2019年09月20日 19:18:32moormasterlinkissue7897 messages
2019年09月20日 19:18:32moormastercreate

AltStyle によって変換されたページ (->オリジナル) /