Skip to content

Commit 8ad136a

Browse files
committed
add test
1 parent 13ebe54 commit 8ad136a

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/snowflake/snowpark/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def __init__(self, **kwargs) -> None:
375375

376376
if kwargs != {}:
377377
raise TypeError(
378-
f"{self.__class__.__name__}() does not accept any arguments, please construct it without parameters."
378+
f"__init__() takes 0 argument but {len(kwargs.keys())} were given"
379379
)
380380

381381
def __eq__(self, other):

tests/integ/test_datatypes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,11 @@ def test_numeric_type_store_precision_and_scale(session, massive_number, precisi
433433
assert isinstance(datatype, LongType)
434434
assert datatype._precision == precision
435435

436+
# after save as table, the precision information is lost, because it is basically save LongType(), which
437+
# does not have precision information, thus set to default 38.
436438
df.write.save_as_table(table_name, mode="overwrite", table_type="temp")
437439
result = session.sql(f"select * from {table_name}")
440+
session.sql(f"describe table {table_name}").show()
438441
datatype = result.schema.fields[0].datatype
439442
assert isinstance(datatype, LongType)
440443
assert datatype._precision == 38
@@ -494,3 +497,8 @@ def write_csv(data):
494497
Utils.drop_stage(session, stage_name)
495498
if os.path.exists(file_path):
496499
os.remove(file_path)
500+
501+
502+
def test_illegal_argument_intergraltype():
503+
with pytest.raises(TypeError, match="takes 0 argument but 1 were given"):
504+
LongType(b=10)

0 commit comments

Comments
 (0)