Results for “assert”

8 results

  1. 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
  2. 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
  3. 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
  4. 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
  5. Challenge

    Test the 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 them fail.

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

    Test the error

    …try , set a variable to True in except ValueError: , and assert it after. Then print: All checks passed Leave the function as it is. The hidden tests swap it for a version that doesn't raise at all…

    Write the code Medium 2 stages testing assert try except
  7. Article Python Fundamentals

    Python If/Else for Beginners

    …fuel_percent, "system:", system_check_passed) Or use assertions in development: assert isinstance(fuel_percent, (int, float)), "fuel must be numeric" Short, practical example — simple mission planner…