def test_is_port_errors(): # Test that is_port returns errors when not given a Port with pytest.raises(ConfigurationError): is_port("foo") # str with pytest.raises(ConfigurationError): is_port(["foo", "bar"]) # list of strs with pytest.raises(ConfigurationError): is_port({"foo": "bar"}) # dict with pytest.raises(ConfigurationError): is_port(1.0) # float with pytest.raises(ConfigurationError): is_port(1) # int
def test_is_port(): # Test that is_port passes a valid port m = ConcreteModel() m.c = Port() assert isinstance(is_port(m.c), Port)