def test_construct_from_string_raises(): with pytest.raises( TypeError, match="Cannot construct a 'SparseDtype' from 'not a dtype'"): SparseDtype.construct_from_string("not a dtype")
def test_construct_from_string(string, expected): result = SparseDtype.construct_from_string(string) assert result == expected
def test_construct_from_string_fill_value_raises(string): with pytest.raises(TypeError, match="fill_value in the string is not"): SparseDtype.construct_from_string(string)
def test_construct_from_string_raises(): with pytest.raises(TypeError): SparseDtype.construct_from_string("not a dtype")