problems icon indicating copy to clipboard operation
problems copied to clipboard

CS50P: check50 for test_numb3rs (PSET 7) doesn't handle invalid input correctly

Open kcw78 opened this issue 2 weeks ago • 1 comments

check50 for doesn't handle 4 digit numbers in IPv4 addresses.

This version of test_numb3rs.py results in an error message

def test_IPrange():
    assert validate(r'255.255.255.255') == True
    assert validate(r'1.1.1.1000') == False

Error message is:

:( test_numb3rs.py catches numb3rs.py only checking if first byte of IPv4 address is in range
    expected exit code 1, not 0

Modify test_numb3rs.py as shown below, and the error goes away.

def test_IPrange():
    assert validate(r'255.255.255.255') == True
    assert validate(r'1.1.1.999') == False

Check50 output: :) test_numb3rs.py catches numb3rs.py only checking if first byte of IPv4 address is in range

kcw78 avatar Feb 08 '25 20:02 kcw78