Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Bad Test

Aperta
#11 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
graphql, python
Ambito
api, testing

Direzione di ricerca

Inizia da tests/test_graphqlview.py, con il test collegato intorno alla riga 481, e confronta il suo nome, la configurazione e le asserzioni con il comportamento proposto di rimappatura del contesto. Rinomina o sostituisci il test secondo necessità, quindi esegui il test pytest pertinente per confermare che la risposta contenga request e non CUSTOM CONTEXT.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

FYI: this test will never run (or it will always run, but it shouldn't).

I'm in the process of porting this to aiohttp and found this...

I believe the test is all kinds of wrong.

  • its name doesn't match what it does (it has nothing to do with pretty printing)
  • I don't understand why 'request' would resolve to {}. I'd assume it'd be repr'd to <Request ...>

I believe the test ought to test that 'CUSTOM CONTEXT' is replaced with an empty dict. at least that's what the code will do when get_context(request) is called and it discovers that self.context is not a dict.

Here's my replacement test (note, this isn't written for sanic, but the premise holds):

    @pytest.mark.asyncio
    async def test_context_remapped(self, client, url_builder):
        response = await client.get(url_builder(query='{context}'))

        _json = await response.json()
        assert response.status == 200
        assert 'request' in _json['data']['context']
        assert 'CUSTOM CONTEXT' not in _json['data']['context']
Lingua principale
Python
Stelle
148
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di graphql-python/sanic-graphql

Tutte le issue di graphql-python/sanic-graphql

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.