From a2c0ca35e54fbfdc2f46cd901d736d1caaae49e1 Mon Sep 17 00:00:00 2001 From: Tiddo Loos Date: Fri, 18 Aug 2023 15:15:16 +0200 Subject: [PATCH] _varargs_labels_as_list test --- tests/test_tables.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/test_tables.py b/tests/test_tables.py index 2d1fcd9c..689625f8 100644 --- a/tests/test_tables.py +++ b/tests/test_tables.py @@ -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) \ No newline at end of file