Skip to content

Commit b439ea1

Browse files
committedApr 30, 2023
add test for trace in free_module_tensor
1 parent 50c9c8b commit b439ea1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# pylint: disable=missing-function-docstring,missing-class-docstring
2+
import pytest
3+
4+
from sage.manifolds.differentiable.examples.euclidean import EuclideanSpace
5+
from sage.manifolds.differentiable.manifold import DifferentiableManifold
6+
7+
8+
class TestR3VectorSpace:
9+
@pytest.fixture
10+
def manifold(self):
11+
return EuclideanSpace(3)
12+
13+
def test_trace_using_metric_works(self, manifold: DifferentiableManifold):
14+
metric = manifold.metric('g')
15+
assert metric.trace(using=metric) == manifold.scalar_field(3)

‎src/sage/tensor/modules/free_module_tensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2515,7 +2515,7 @@ def trace(
25152515
25162516
The contraction on two slots having the same tensor type cannot occur::
25172517
2518-
sage: b = M.tensor((2,0), name='b') ; b
2518+
sage: b = M.tensor((2,0), name='b') ; b
25192519
Type-(2,0) tensor b on the Rank-3 free module M over the Integer Ring
25202520
sage: b[:] = [[1,2,3], [4,5,6], [7,8,9]]
25212521
sage: b.trace(0,1)

0 commit comments

Comments
 (0)
Please sign in to comment.