Problem
field.py line 60 uses assert 0 <= port < 65536 for port validation. Assertions can be stripped with python -O, silently disabling the validation at runtime.
Solution
- Replace
assert with if not (0 <= port < 65536): raise ValueError(...)
- Update tests to check for
ValueError instead of AssertionError