MCPcopy
hub / github.com/marimo-team/marimo / test_query_includes_limit

Function test_query_includes_limit

tests/_sql/test_sql.py:398–430  ·  view source on GitHub ↗

Test _query_includes_limit function.

()

Source from the content-addressed store, hash-verified

396
397@pytest.mark.skipif(not HAS_SQLGLOT, reason="sqlglot not installed")
398def test_query_includes_limit() -> None:
399 """Test _query_includes_limit function."""
400 # Test queries with LIMIT
401 assert _query_includes_limit("SELECT * FROM table LIMIT 5")
402 assert _query_includes_limit("SELECT * FROM table LIMIT\n5")
403 assert _query_includes_limit("SELECT * FROM table limit\n5")
404 assert _query_includes_limit(
405 """
406 SELECT *
407 FROM table
408 LIMIT 5
409 """
410 )
411
412 # Test queries without LIMIT
413 assert not _query_includes_limit("SELECT * FROM table")
414 assert not _query_includes_limit("SELECT LIMIT_COL FROM table")
415 assert not _query_includes_limit("-- LIMIT 5\nSELECT * FROM table")
416
417 # Test invalid SQL
418 assert not _query_includes_limit("NOT A VALID SQL QUERY")
419 assert not _query_includes_limit("")
420 assert not _query_includes_limit("INSERT INTO t VALUES (1, 2, 3)")
421
422 # Multiple queries
423 assert (
424 _query_includes_limit("SELECT * FROM t; SELECT * FROM t2 LIMIT 5")
425 is True
426 )
427 assert (
428 _query_includes_limit("SELECT * FROM t LIMIT 5; SELECT * FROM t2")
429 is False
430 )
431
432
433@patch("marimo._sql.sql.replace")

Callers

nothing calls this directly

Calls 1

_query_includes_limitFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…