forked from NVIDIA/cutile-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_constant.py
More file actions
28 lines (20 loc) · 741 Bytes
/
test_constant.py
File metadata and controls
28 lines (20 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# SPDX-FileCopyrightText: Copyright (c) <2025> NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
# example-begin imports
import cuda.tile as ct
# example-end imports
# example-begin constant
def needs_constant(x: ct.Constant):
pass
def needs_constant_int(x: ct.Constant[int]):
pass
# example-end constant
# TODO: Run with `mypy --check-untyped-defs` or another static type checker.
def test_constant_type_hints() -> None:
int_constant: ct.Constant[int] = 42
float_constant: ct.Constant[float] = 3.14
needs_constant(int_constant)
needs_constant(float_constant)
needs_constant_int(int_constant)
needs_constant_int(float_constant) # Should fail type checking