VoiceGem

How to dictate a pytest test function and its assertion

Pytest test names are long snake_case sentences and its assertions are plain Python, which makes this the cleanest test dictation of any language on this site. “def snake case test returns none for missing key open paren close paren colon” returns a complete definition.

A thirteen-word pytest definition costs about 15 seconds typed against about 4.8 seconds spoken. (sources: Dhakal, Feit, Kristensson & Oulasvirta, “Observations on Typing from 136 Million Keystrokes”, CHI 2018, 168,000 participants, 136 million keystrokes; Yuan, Liberman & Cieri, “Towards an Integrated Understanding of Speaking Rate in Conversation”, Interspeech 2006, 2,438 American English telephone conversations (Switchboard corpus). The speech figure is conversational rate, not a measured dictation rate — no such measurement exists.)

What lands in your editor
def test_returns_none_for_a_missing_configuration_key():

This tool runs entirely in your browser. Nothing you type is sent anywhere, stored, or logged.

Step by step

  1. 1

    Say “def snake case test” then the behaviour

    Speak the whole name as one run of words. A casing run consumes every plain word until a symbol arrives, so a nine-word test name is one command.

  2. 2

    Close with “open paren close paren colon”

    Say the three phrases together. The bracket pair and the colon all attach left in VoiceGem's table, so the definition ends exactly as Python formats it.

  3. 3

    Say the assertion as plain Python

    Speak “assert”, the expression, “double equals” and the expected value. Pytest needs no assertion helpers, so the line is mostly words.

  4. 4

    The keyboard alternative

    Type the test name with underscores. A nine-word name is eight Shift-hyphens, which is the specific cost this page is about.

Pytest is the best test dictation target of any language on this site

Three properties line up. Test names are long snake_case sentences, which is exactly what a casing command is for; assertions are plain Python expressions rather than framework helper calls; and nothing in a pytest file needs a bracket, brace or generic that VoiceGem spaces awkwardly.

The result is a test file that dictates with no cleanup at all. A nine-word test name is one casing command and nine spoken words, against eight Shift-hyphen presses and nine typed words — which is the clearest speed argument the Deterministic Pass has anywhere.

Where the manual way breaks

A three-word test name is quick to type and nobody is struggling with test_parses_json. Short names are not the problem.

Long names are exactly where typing degrades. Underscore-separated names get shortened because each underscore is a modifier press, and a shortened pytest name defeats the reason pytest names are readable in the first place. Dictating in VoiceGem makes the long name cheaper than the short one, because both are just words.

Doing this somewhere else? our speech-to-code converter, the same thing for dictating Python docstrings, dictating Python functions, step by step, or naming things in Python by voice.

Common questions

No. Nothing in a pytest file uses a character VoiceGem spaces awkwardly, so the definitions and assertions arrive ready to run.

As long as you keep saying plain words. The run ends at the first symbol phrase, whitespace command or other casing command.

Yes. Say “at sign pytest dot mark dot snake case parametrize”. The at sign binds rightward and the periods bind on both sides.

Dictate a ten-word pytest name and count the underscores you skipped.

Open the tool