0
爲什麼外層循環只執行最後一次迭代?爲什麼我的循環沒有迭代?
class LanguageSpecificTest(unittest.TestCase):
# Body omitted
for style in [ "inline", "inline_scripted",
"external", "external_scripted",
"internal", "internal_scripted",
]:
print style
for language, text_id, direction, text, check_text in (
("french", "reply_1", "с французского", "жизнь", "В большом дворце, в Ферраре, в один зимний вечер"),
):
test_name = 'test_translation_test_phrases_for_%s_pages' % language
def my_test_generator(language, text_id, check_text):
def ubergenerator(self):
#####
return ubergenerator
t = my_test_generator(language, text_id, check_text)
t.__name__ = test_name
setattr(LanguageSpecificTest, test_name, t)
當我啓動測試中,它打印:
inline
inline_scripted
external
external_scripted
internal
internal_scripted
http://127.0.0.1:5000/translate?lang=french&style=internal_scripted
,去只有通過一個測試,不是6。爲什麼我看不到
http://127.0.0.1:5000/translate?lang=french&style=inline
http://127.0.0.1:5000/translate?lang=french&style=inline_scripted
http://127.0.0.1:5000/translate?lang=french&style=external
http://127.0.0.1:5000/translate?lang=french&style=external_scripted
http://127.0.0.1:5000/translate?lang=french&style=internal
http://127.0.0.1:5000/translate?lang=french&style=internal_scripted
哦天啊,救我星期五晚上。
你爲什麼不告訴我們我們可以實際運行的東西? – NPE
你是否嘗試過使用調試器? – Alkini