def test_returns_single_element(self): assert lists.unlist(["thing"]) == "thing"
def test_complains_if_empty(self): with pytest.raises(ValueError): lists.unlist([])
def test_doesnt_complain_if_told_not_to(self): assert lists.unlist([1, 2], False) is None assert lists.unlist([], False) is None
def test_complains_if_multi_element(self): with pytest.raises(ValueError): lists.unlist([1, 2])