Hello, I just finished the Python Port Scanner project and it passed the web validator.
The fun fact is that it was failing one test in replit. I looked at the test code and I think it is not correctly implemented.
def test_port_scanner_verbose_ip_hostname_returned_multiple_ports(self):
str = port_scanner.get_open_ports("137.74.187.104", [440, 450], True)
actual = str
expected = "Open ports for hackthissite.org (137.74.187.104)\nPORT SERVICE\n443 https"
self.assertEqual(actual, expected, "Expected 'Open ports for hackthissite.org (137.74.187.104)\nPORT SERVICE\n443 https'")
As you can see the first argument for port_scanner.get_open_ports is the IP address but in the expected answer it require the Hostname + IP address. Either change the first parameter to the hostname or the answer to expect only IP, otherwise it will not work if we complete the project according to the given info. Also the function title is not what the result expect: Test port_scanner verbose ip HOSTNAME returned MULTIPLE PORTS. It doesn’t have hostname and don’t expect multiple ports returned, just one opened.