Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arraycontext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
arraycontext
Commits
4643e1f5
Commit
4643e1f5
authored
2 months ago
by
Alexandru Fikl
Committed by
Andreas Klöckner
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
tests: use Optional and Tuple to test decorator
parent
bc7139f8
No related branches found
No related tags found
No related merge requests found
Pipeline
#636346
failed
1 month ago
Stage: test
Changes
2
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arraycontext/impl/pytato/fake_numpy.py
+1
-1
1 addition, 1 deletion
arraycontext/impl/pytato/fake_numpy.py
test/test_utils.py
+4
-3
4 additions, 3 deletions
test/test_utils.py
with
5 additions
and
4 deletions
arraycontext/impl/pytato/fake_numpy.py
+
1
−
1
View file @
4643e1f5
...
...
@@ -240,6 +240,6 @@ class PytatoFakeNumpyNamespace(LoopyBasedFakeNumpyNamespace):
return
self
.
abs
(
a
)
def
vdot
(
self
,
a
:
Array
,
b
:
Array
):
return
rec_multimap_array_container
(
pt
.
vdot
,
a
,
b
)
# }}}
This diff is collapsed.
Click to expand it.
test/test_utils.py
+
4
−
3
View file @
4643e1f5
...
...
@@ -27,7 +27,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
"""
import
logging
from
typing
import
cast
from
typing
import
Optional
,
Tuple
,
cast
# noqa: UP035
import
numpy
as
np
import
pytest
...
...
@@ -63,7 +63,7 @@ def test_dataclass_array_container() -> None:
class
ArrayContainerWithOptional
:
x
:
np
.
ndarray
# Deliberately left as Optional to test compatibility.
y
:
np
.
ndarray
|
None
y
:
Optional
[
np
.
ndarray
]
# noqa: UP045
with
pytest
.
raises
(
TypeError
,
match
=
"
Field
'
y
'
union contains non-array
"
):
# NOTE: cannot have wrapped annotations (here by `Optional`)
...
...
@@ -76,7 +76,8 @@ def test_dataclass_array_container() -> None:
@dataclass
class
ArrayContainerWithTuple
:
x
:
Array
y
:
tuple
[
Array
,
Array
]
# Deliberately left as Tuple to test compatibility.
y
:
Tuple
[
Array
,
Array
]
# noqa: UP006
with
pytest
.
raises
(
TypeError
,
match
=
"
Typing annotation not supported on field
'
y
'"
):
dataclass_array_container
(
ArrayContainerWithTuple
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment