Better signature tests for required arguments
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
- 45/100
Hướng nghiên cứu
Bắt đầu bằng cách tìm các bài kiểm tra chữ ký và helper specified_kwargs() được đề cập trong issue, sau đó chạy các bài kiểm tra hiện có của chúng để hiểu hành vi hiện tại. Được xem là hoàn thành khi các chữ ký có thêm các đối số vị trí bắt buộc bị lỗi, trong khi các đối số vị trí tùy chọn được kiểm tra cả theo vị trí lẫn bằng từ khóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
This signature tests do not properly check for cases where a function has more required positional arguments than it should. Such a case should be considered noncompliant, since user code written against the standard signature would not function. For example, if the standard has a function
def f(x, y=None):
...
then a function
def f(x, y):
...
should fail the signature test, because code like f(a) should work according to the standard but it wouldn't in the implementation.
Practically speaking, this would help me catch bugs with the xp signature logic in array-api-compat (see https://data-apis.org/array-api-compat/dev/implementation-notes.html). For instance, I accidentally wrote
def clip(
x: ndarray,
/,
xp,
min: Optional[Union[int, float, ndarray]] = None,
max: Optional[Union[int, float, ndarray]] = None,
) -> ndarray:
but it should have been
def clip(
x: ndarray,
/,
min: Optional[Union[int, float, ndarray]] = None,
max: Optional[Union[int, float, ndarray]] = None,
*,
xp,
) -> ndarray:
The former works if you pass min and max as keywords but not if you pass them positionally (array-api-compat has a decorator that automatically injects the xp keyword argument into the final signature).
Additionally, some helpers to test optional positional arguments as both positional and keyword in the test itself would be useful. Right now we have specified_kwargs() but it doesn't allow passing the arguments as positional.
- Ngôn ngữ chính
- Python
- Star
- 74
- Fork
- 54
- Merge trung bình
- 4 giờ 35 phút
- Pull request đã merge (30 ngày)
- 4
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
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 data-apis/array-api-tests
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 87/100
data-apis/array-api-tests#465 · 1 bình luận ·
-
Test reflected operators? Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
data-apis/array-api-tests#460 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
data-apis/array-api-tests#455 · 2 bình luận ·
-
tracking
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/array-api-tests#381 · 9 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
data-apis/array-api-tests#379 · 10 bình luận ·
Tất cả issue của data-apis/array-api-tests
Issue tương tự
-
essnmx good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
-
[Feature] 奇物选择添加优先级 Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
syfoud/Simulated_Scepter#174 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Giskard-AI/giskard-oss#2840 · 1 bình luận ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Đang mởarea: repo bug perceived difficulty: 2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
yeti-platform/yeti#1380 ·