File: std_LT01_LT04_test.py

package info (click to toggle)
sqlfluff 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,000 kB
  • sloc: python: 106,131; sql: 34,188; makefile: 52; sh: 8
file content (21 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Tests the python routines within LT01."""

import sqlfluff


def test__rules__std_LT01_single_raise() -> None:
    """Test case for multiple LT01 errors raised when no post comma whitespace."""
    # This query used to triple count LT01. Added memory to log previously fixed commas
    # (issue #2001).
    sql = """
SELECT
    col_a AS a
    ,col_b AS b
FROM foo;
"""
    result = sqlfluff.lint(sql, rules=["LT01", "LT04"])

    results_LT01 = [r for r in result if r["code"] == "LT01"]
    results_LT04 = [r for r in result if r["code"] == "LT04"]
    assert len(results_LT01) == 1
    assert len(results_LT04) == 1