Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jvasquezrojas committed Aug 23, 2024
1 parent 349c24b commit cd1a213
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ SQLACHEMY_WARN_20 = "1"

[tool.hatch.envs.default.scripts]
check = "pre-commit run --all-files"
test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/ --collect-only"
test-dialect = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml --ignore=tests/sqlalchemy_test_suite tests/"
test-dialect-compatibility = "pytest -ra -vvv --tb=short --cov snowflake.sqlalchemy --cov-append --junitxml ./junit.xml tests/sqlalchemy_test_suite"
gh-cache-sum = "python -VV | sha256sum | cut -d' ' -f1"
check-import = "python -c 'import snowflake.sqlalchemy; print(snowflake.sqlalchemy.__version__)'"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_custom_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_string_conversions():


@pytest.mark.feature_max_lob_size
def test_create_table_with_text_type_and_max_lob_size(engine_testaccount):
def test_create_table_with_text_type(engine_testaccount):
metadata = MetaData()
table_name = "test_max_lob_size_0"
test_max_lob_size = Table(
Expand Down
23 changes: 23 additions & 0 deletions tests/test_orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest
from sqlalchemy import (
TEXT,
Column,
Enum,
ForeignKey,
Expand Down Expand Up @@ -413,3 +414,25 @@ class Employee(Base):
'[SELECT "Employee".uid FROM "Employee" JOIN LATERAL flatten(PARSE_JSON("Employee"'
in caplog.text
)


@pytest.mark.feature_max_lob_size
def test_basic_orm_metadata(engine_testaccount):
Base = declarative_base()

class User(Base):
__tablename__ = "user"

name = Column(String, primary_key=True)
fullname = Column(TEXT(134217728))

def __repr__(self):
return f"<User({self.name!r}, {self.fullname!r})>"

Base.metadata.create_all(engine_testaccount)

try:
assert User.__table__.columns["fullname"].type.length == 134217728

finally:
Base.metadata.drop_all(engine_testaccount)

0 comments on commit cd1a213

Please sign in to comment.