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
Alexandru Fikl
arraycontext
Commits
b38a12f1
Commit
b38a12f1
authored
3 years ago
by
Andreas Klöckner
Committed by
Andreas Klöckner
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Test equality-comparison behavior of with_container_arithmetic
parent
1378c420
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_arraycontext.py
+20
-2
20 additions, 2 deletions
test/test_arraycontext.py
with
20 additions
and
2 deletions
test/test_arraycontext.py
+
20
−
2
View file @
b38a12f1
...
...
@@ -492,9 +492,10 @@ def test_array_context_einsum_array_tripleprod(actx_factory, spec):
# }}}
# {{{
test
array container
# {{{ array container
classes for test
@with_container_arithmetic
(
bcast_obj_array
=
False
,
rel_comparison
=
True
)
@with_container_arithmetic
(
bcast_obj_array
=
False
,
eq_comparison
=
False
,
rel_comparison
=
False
)
@dataclass_array_container
@dataclass
(
frozen
=
True
)
class
MyContainer
:
...
...
@@ -765,6 +766,23 @@ def test_norm_ord_none(actx_factory, ndim):
np
.
testing
.
assert_allclose
(
actx
.
to_numpy
(
norm_a
),
norm_a_ref
)
def
test_container_equality
(
actx_factory
):
actx
=
actx_factory
()
ary_dof
,
_
,
_
,
dc_of_dofs
,
bcast_dc_of_dofs
=
\
_get_test_containers
(
actx
)
_
,
_
,
_
,
dc_of_dofs_2
,
bcast_dc_of_dofs_2
=
\
_get_test_containers
(
actx
)
# MyContainer sets eq_comparison to False, so equality comparison should
# not succeed.
dc
=
MyContainer
(
name
=
"
yoink
"
,
mass
=
ary_dof
,
momentum
=
None
,
enthalpy
=
None
)
dc2
=
MyContainer
(
name
=
"
yoink
"
,
mass
=
ary_dof
,
momentum
=
None
,
enthalpy
=
None
)
assert
dc
!=
dc2
assert
isinstance
(
bcast_dc_of_dofs
==
bcast_dc_of_dofs_2
,
MyContainerDOFBcast
)
if
__name__
==
"
__main__
"
:
import
sys
if
len
(
sys
.
argv
)
>
1
:
...
...
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