Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Hypothesis integration

Offen
#234 2 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
testing

Rechercherichtung

Beginnen Sie mit dem Lesen der referenzierten returns/contrib/hypothesis/laws.py und vergleichen Sie sie mit den vorhandenen typeclass- und mypy-Prüfungen in diesem Projekt. Definieren Sie die vorgeschlagene check_typeclass-Strategie und ihre Optionen allow_instances, allow_protocols und allow_unknown. Überprüfen Sie anschließend, dass unterstützte Fälle gültige Rückgabetypen liefern und nicht unterstützte Fälle NotImplementedError erzeugen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement

Right now we don't test classes with hypothesis at all.

But, I have a great idea (at least it seems to me like so) of adding a hypothesis plugin, similar to one we have in returns: https://github.com/dry-python/returns/blob/master/returns/contrib/hypothesis/laws.py

What should it do?

  • check_typeclass(typeclass_instance) will check that for all existing types and protocols some valid return type is produced. For example, @typeclass def some(instance) -> str must produce str for all instance, protocol, and supported types and it must produce NotImplementedError for types that are not supported
  • Looks like check_typeclass must have allow_instances, allow_protocols, allow_unknown kw bool arguments to configure what types we actually need in a resulting strategy

It would be a nice companion to our mypy check.

@Zac-HD do you like it? Maybe you have any other ideas?

Vorherrschende Sprache
Python
Sterne
730
Forks
30
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus dry-python/classes

Alle Issues in dry-python/classes

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.