Results for “testing”

8 results

  1. Challenge

    Legacy script

    A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…

    Fix the code Hard 2 stages project refactoring functions testing
  2. Challenge

    Test the pipeline

    The telemetry pipeline is now split into parse_row() and check_limits(). Write assert tests for both, good rows, rejected rows and readings right at a limit, so that each of three planted bugs makes…

    Write the code Hard 2 stages project testing assert try
  3. Challenge

    Seeded simulation

    Simulate 100 sensor readings, each with a 5% chance of a glitch, and seed random with 42 so the count is the same on every run and a test can check it exactly, then pick a kind for each glitch with…

    Write the code Easy 2 stages random random.seed random.choice simulation
  4. Challenge

    Test the error

    Write a check that passes only when fuel_needed(-5) raises ValueError, so a version that returns a value or raises the wrong error fails it, then pin down the message and the lengths that must still…

    Write the code Medium 2 stages testing assert try except
  5. Challenge

    Prove the fix

    Write assert checks for the fixed add_sample() that would have caught the shared default list, then add checks that a log passed in is still the one that gets the sample, so a "fix" that breaks that…

    Write the code Medium 2 stages testing assert regression tests default values
  6. Challenge

    Edge cases

    Write assert checks for mean(): an ordinary list and a list with one value first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the…

    Write the code Medium 2 stages testing assert edge cases None
  7. Challenge

    Test the alert levels

    Write assert checks for alert_level(): one temperature for each level first, then the values exactly on each threshold and just below them, so a > written instead of >= can't slip through.

    Write the code Medium 2 stages testing assert functions boundaries
  8. Challenge

    Test the parser

    Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…

    Write the code Medium 2 stages testing assert parsing None