def test_size_minus_14_not_valid(): with pytest.raises(Exception) as e: size(-14) print(e) assert "Invalid pixel" in str(e)
def test_size_million_not_valid(): with pytest.raises(Exception) as e: size(1e6) assert "Invalid pixel" in str(e)
def test_size_asdf_gives_ValueError(): with pytest.raises(Exception) as e: size("asdf") assert "Error" in str(e)
def test_size_140_is_valid(): assert size(140) == 140