Copilot commented on code in PR #8067:
URL: https://github.com/apache/texera/pull/8067#discussion_r3885871057


##########
amber/src/test/python/core/models/test_table.py:
##########
@@ -142,3 +144,79 @@ def test_use_table_as_data_frame(self, target_table, 
target_data_frame):
     def test_validation_of_schema(self):
         with pytest.raises(AssertionError):
             Table([{"text": "hello"}, {"book": "harry"}])
+
+    @pytest.mark.parametrize(
+        "table_like", [42, "hello", None, {"field1": [1, 2]}, (1, 2), b"bytes"]
+    )
+    def test_an_unsupported_tablelike_is_rejected(self, table_like):
+        # Only Table / DataFrame / list reach a constructor; anything else must
+        # be refused with a message naming the offending type, rather than
+        # falling through into `super().__init__` with an unbound frame.
+        #
+        # Match the *whole* rendered message, interpolation included: a prefix
+        # match would leave `{type(table_like)}` -- the only non-constant part
+        # of that line -- unpinned, and would also make all six parametrized
+        # cases assert the identical string.
+        expected = re.escape(f"unsupported tablelike type {type(table_like)}")
+        with pytest.raises(TypeError, match=expected):
+            Table(table_like)

Review Comment:
   The comment says this test matches the *whole* error message, but 
`pytest.raises(..., match=...)` uses `re.search`, and the current pattern isn’t 
anchored. That means a message like `unsupported tablelike type <...> (extra 
context)` would still pass, so the “whole message” claim is inaccurate. Either 
anchor the regex with `^...$` (recommended) or adjust the comment to match the 
weaker guarantee.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to