Tests appear to be running in alphabetical order for Raindrops
まだ誰も着手していません。
評価
調査の方向性
raindrops_test.py から始め、pytest -x raindrops_test.py を使って順序を再現します。観測されたアルファベット順を、テスト定義および試行した設定 unittest.TestLoader.sortTestMethodsUsing と比較します。演習のテストが意図された進行順で実行されるか、リポジトリに文書化された一貫性のある代替手段がある状態を完了とします。
索引モデルが issue の本文から書いたものです。
説明
I tried out a couple of exercises on the Python track today, and noticed with the Raindrops exercise in particular that the tests were requiring me to implement the entire algorithm on the second failure.
I'm working in Python 3.8.5.
I run the tests with the following command:
pytest -x raindrops_test.py
With the unchanged stub file in place, I get the following failure:
def test_2_to_the_power_3_does_not_make_a_raindrop_sound_as_3_is_the_exponent_not_the_base(
self
):
> self.assertEqual(convert(8), "8")
E AssertionError: None != '8'
This is a reasonable "first" failure, since it's a single number that should be turned into a string.
If I make that pass with a hard-coded return "8", then this is the next failure I get:
def test_the_sound_for_105_is_pling_plang_plong_as_it_has_factors_3_5_and_7(self):
> self.assertEqual(convert(105), "PlingPlangPlong")
E AssertionError: '8' != 'PlingPlangPlong'
E - 8
E + PlingPlangPlong
Looking at the tests, the order that they are defined in is quite nice, in terms of pushing the implementation forward step by step.
I tried adding the following declaration after the import unittest statement, to see if this would cause the tests to be run in the order that they are defined:
unittest.TestLoader.sortTestMethodsUsing = None
This did not change the order that the tests are run in.
If I sort the tests alphabetically by name, it appears to correspond to the order that I'm seeing when doing the exercise:
While under normal circumstances I would want tests to be run in random order, in Exercism exercises I think that it would make more sense to run the tests in the order that they are defined.
Is there a declaration we can make in order to accomplish this?
If not, then I would propose that we rename tests by adding a numeric prefix to the test name (e.g.
def test_01_the_sound_for_1_is_1(self):
- 主要言語
- Python
- スター
- 2.5k
- フォーク
- 1.5k
- 平均マージ
- 2日 17時間
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
exercism/python のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
[General Docs] Audit/Cleanup of Track General/Shared Docs対応中かも @Yrahcaz7 が 6 日前に担当しました。 オープン
-
[Decimals]: New Concept and Concept Exercise再び着手できるかも @BethanyG が 516 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
exercism/python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
-
bug difficulty:2
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
MakazhanAlpamys/Soup#3167 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
snap-stanford/Biomni#380 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jsboige/CoursIA#27768 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
rossant/awesome-math#206 ·