def test_empty_obs_no(attr_name, expected_value): assert (getattr(ObsNo(), attr_name) == expected_value ) # against PEP8 for None but should work
def test_dodgy_obs_no_3(): with pytest.raises(ValueError): ObsNo("662800142")
def test_obs_no_parsing(test_input, expected): assert ObsNo(test_input) == expected
def test_dodgy_obs_no_2(): with pytest.raises(TypeError): ObsNo(662800142)
def test_dodgy_obs_no(): with pytest.raises(ValueError): ObsNo(6628, 142)
def test_obs_no_hash(): obs_no = ObsNo("NOA 2") assert {obs_no: "value"}[obs_no] == "value"
def test_accept_empty_obs_no(): ObsNo()
def test_obs_no_iter(): obs_no = ObsNo("NOA-2") assert [x for x in obs_no] == ["NOA", 2]