sqlrules-mssql 1.0.0__tar.gz → 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11,6 +11,7 @@ __pycache__/
11
11
  htmlcov/
12
12
  dist/
13
13
  dist-plugins/
14
+ dist-missing/
14
15
  build/
15
16
  *.egg-info/
16
17
  .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlrules-mssql
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: SQL Server dialect plugin for SQLRules (JSON and LEN string ops).
5
5
  Project-URL: Homepage, https://github.com/eddiethedean/sqlrules
6
6
  Project-URL: Repository, https://github.com/eddiethedean/sqlrules
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sqlrules-mssql"
7
- version = "1.0.0"
7
+ version = "1.0.1"
8
8
  description = "SQL Server dialect plugin for SQLRules (JSON and LEN string ops)."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -6,7 +6,7 @@ from sqlrules_mssql.json import translate_json_contains, translate_json_has_key
6
6
  from sqlrules_mssql.length import translate_max_length, translate_min_length
7
7
  from sqlrules_mssql.type_check import translate_type_check
8
8
 
9
- __version__ = "1.0.0"
9
+ __version__ = "1.0.1"
10
10
 
11
11
 
12
12
  class MssqlPlugin:
@@ -9,17 +9,23 @@ from sqlalchemy.dialects import mssql
9
9
  from sqlrules_mssql import MssqlPlugin, __version__
10
10
 
11
11
  from sqlrules import Compiler, JsonContains, JsonHasKey, UnsupportedConstraintError
12
- from sqlrules.conformance import assert_builtins_preserved, assert_plugin_api_compatible
12
+ from sqlrules.conformance import run_basic_conformance
13
13
 
14
14
 
15
15
  def test_version() -> None:
16
- assert __version__ == "1.0.0"
16
+ assert __version__ == "1.0.1"
17
17
 
18
18
 
19
- def test_plugin_api() -> None:
20
- plugin = MssqlPlugin()
21
- assert_plugin_api_compatible(plugin)
22
- assert_builtins_preserved(plugin, on_conflict="replace")
19
+ def test_conformance() -> None:
20
+ # MSSQL does not register pattern; exercise length override instead.
21
+ class LengthFilter(BaseModel):
22
+ name: Annotated[str, Field(min_length=2)]
23
+
24
+ run_basic_conformance(
25
+ MssqlPlugin(),
26
+ operator="min_length",
27
+ model=LengthFilter,
28
+ )
23
29
 
24
30
 
25
31
  def test_length_uses_trailing_space_aware_len() -> None:
@@ -33,11 +39,15 @@ def test_length_uses_trailing_space_aware_len() -> None:
33
39
  cache=False,
34
40
  ).compile(Filter, table)
35
41
  dialect = mssql.dialect()
36
- min_sql = str(rules["name"][0].compile(dialect=dialect)).lower()
37
- max_sql = str(rules["name"][1].compile(dialect=dialect)).lower()
38
- assert "len(" in min_sql and ">=" in min_sql
39
- assert "len(" in max_sql and "<=" in max_sql
40
- assert "||" in min_sql or "concat" in min_sql or "+" in min_sql
42
+ min_sql = str(
43
+ rules["name"][0].compile(dialect=dialect, compile_kwargs={"literal_binds": True})
44
+ ).lower()
45
+ max_sql = str(
46
+ rules["name"][1].compile(dialect=dialect, compile_kwargs={"literal_binds": True})
47
+ ).lower()
48
+ # Trailing-space-aware: LEN(name + '.') - 1, not portable length()/plain LEN(name).
49
+ assert min_sql == "len(items.name + '.') - 1 >= 2"
50
+ assert max_sql == "len(items.name + '.') - 1 <= 10"
41
51
  assert "length(" not in min_sql
42
52
  assert "length(" not in max_sql
43
53
 
File without changes
File without changes