Skip to content

Commit

Permalink
_varargs_labels_as_list test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiddoloos committed Aug 18, 2023
1 parent ec3ebcd commit a2c0ca3
Showing 1 changed file with 23 additions and 0 deletions.
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)

0 comments on commit a2c0ca3

Please sign in to comment.