Skip to content

Commit 13ebe54

Browse files
committed
add test
1 parent 20735a1 commit 13ebe54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/snowflake/snowpark/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,9 @@ def _fill_ast(self, ast: proto.DataType) -> None:
371371
# Numeric types
372372
class _IntegralType(_NumericType):
373373
def __init__(self, **kwargs) -> None:
374-
self._precision = kwargs.get("_precision", None)
374+
self._precision = kwargs.pop("_precision", None)
375375

376-
if kwargs:
376+
if kwargs != {}:
377377
raise TypeError(
378378
f"{self.__class__.__name__}() does not accept any arguments, please construct it without parameters."
379379
)

tests/integ/test_datatypes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,17 @@ def test_numeric_type_store_precision_and_scale(session, massive_number, precisi
429429
[Decimal(massive_number)],
430430
StructType([StructField("large_value", DecimalType(precision, 0), True)]),
431431
)
432+
datatype = df.schema.fields[0].datatype
433+
assert isinstance(datatype, LongType)
434+
assert datatype._precision == precision
435+
432436
df.write.save_as_table(table_name, mode="overwrite", table_type="temp")
433437
result = session.sql(f"select * from {table_name}")
434438
datatype = result.schema.fields[0].datatype
435439
assert isinstance(datatype, LongType)
436440
assert datatype._precision == 38
437441
finally:
438-
session.sql(f"drop table {table_name}").collect()
442+
session.sql(f"drop table if exists {table_name}").collect()
439443

440444

441445
@pytest.mark.skipif(

0 commit comments

Comments
 (0)