Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_varargs_labels_as_list test #597

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/test_tables.py
Expand Up @@ -1938,3 +1938,26 @@ def test_no_records():
empty_table = Table()
records_empty_table = Table().from_records([])
assert empty_table == records_empty_table

def test_varargs_labels_as_list():
"""Test for _varargs_labels_as_list"""

# Test empty label list should return an empty list
label_list = []
result = tables._varargs_labels_as_list(label_list)
assert result == []

# Test a single non-iterable label should return the same label
label_list = ["label1"]
result = tables._varargs_labels_as_list(label_list)
assert result == label_list

# Test a singleton list of labels should return the inner list
label_list = [["label1", "label2"]]
result = tables._varargs_labels_as_list(label_list)
assert result == label_list[0]

# Test multiple lists of labels should raise a ValueError
label_list = [["label1", "label2"], ["label3", "label4"]]
with pytest.raises(ValueError):
tables._varargs_labels_as_list(label_list)