def test_illegal_len_version(version_tuple): """test_version | Raise if len(version) not in (3, 4)""" with pytest.raises(Exception): swversion.get_version_string(version_tuple)
def test_four_version(): """test_version | 3 digit + string tuple -> version string""" assert swversion.get_version_string((0, 1, 2, "alpha")) == "0.1.2.alpha"
def test_illegal_three_version(): """test_version | Raise if a 3-len tuple has a non-digit""" with pytest.raises(TypeError): swversion.get_version_string(("one", "two", "three"))
def test_legal_version(version_tuple): """test_version | version tuple -> version string""" assert swversion.get_version_string(version_tuple[1]) == version_tuple[0]
def test_four_version(self): """test_version | 3 digit + string tuple -> version string """ assert swversion.get_version_string((0, 1, 0, 'alpha')) == '0.1.0-alpha'
def test_illegal_three_version(self): """test_version | Raise if a 3-len tuple has a non-digit """ with pytest.raises(TypeError): swversion.get_version_string(('one', 'two', 'three'))