From da00cc1a189d899024d62f005134eb9538a73777 Mon Sep 17 00:00:00 2001 From: MossIV Date: Sun, 7 Dec 2025 20:06:56 +1300 Subject: [PATCH] Implemented code coverage for _as_label function Test case tests the _as_label function to see if it raises a ValueError exception along with the appropriate exception message --- tests/test_tables.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_tables.py b/tests/test_tables.py index 2354f27d..26e57d9b 100644 --- a/tests/test_tables.py +++ b/tests/test_tables.py @@ -1995,3 +1995,12 @@ def test_num_columns(table): """Test that Tables returns right number of columns""" number = table.num_columns assert number == 3 + +def test_as_label(table): + """Test that as_label raises ValueError for invalid index_or_label along with correct message""" + + invalid_input = None + + with pytest.raises(ValueError) as t: + table._as_label(invalid_input) + assert str(t.value) == "None is not a label or index" \ No newline at end of file