Tests appear to be running in alphabetical order for Raindrops
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với raindrops_test.py và tái hiện thứ tự bằng pytest -x raindrops_test.py. So sánh thứ tự alphabet quan sát được với các định nghĩa test và thiết lập unittest.TestLoader.sortTestMethodsUsing đã thử. Được xem là hoàn tất khi các test của bài tập chạy theo trình tự dự kiến, hoặc repository có một phương án thay thế được ghi lại và nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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):
- Ngôn ngữ chính
- Python
- Star
- 2.5k
- Fork
- 1.5k
- Merge trung bình
- 2 ngày 17 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của exercism/python
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
-
Current status of approachesĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
[General Docs] Audit/Cleanup of Track General/Shared DocsCó thể đã có người làm @Yrahcaz7 đã nhận 6 ngày trước. Đang mở
-
[Decimals]: New Concept and Concept ExerciseCó thể làm lại được @BethanyG đã nhận 516 ngày trước và không có pull request nào đang mở. Đang mở
Tất cả issue của exercism/python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug difficulty:2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MakazhanAlpamys/Soup#3167 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
snap-stanford/Biomni#380 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jsboige/CoursIA#27768 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Resource]: Math ParadoxesĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
rossant/awesome-math#206 ·