Skip to content

Commit c312ff9

Browse files
committed
Deprecate mv_I and mx_x
No one should be using these, there are better alternatives
1 parent 0b8c38a commit c312ff9

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

galgebra/ga.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,14 +484,22 @@ def I(self): # Noromalized pseudo-scalar
484484
@property
485485
def mv_I(self):
486486
# This exists for backwards compatibility. Note this is not `I()`!
487+
# galgebra 0.4.5
488+
warnings.warn(
489+
"`ga.mv_I` is deprecated, use `ga.E()` instead, or perhaps `ga.I()`",
490+
DeprecationWarning, stacklevel=2)
487491
# default pseudoscalar
488492
return self.E()
489493

490494
@property
491495
def mv_x(self):
492496
# This exists for backwards compatibility.
497+
# galgebra 0.4.5
498+
warnings.warn(
499+
"`ga.mv_x` is deprecated, use `ga.mv(your_name, 'vector')` instead",
500+
DeprecationWarning, stacklevel=2)
493501
# testing vectors
494-
return Mv('XxXx', 'vector', ga=self)
502+
return mv.Mv('XxXx', 'vector', ga=self)
495503

496504
def X(self):
497505
return self.mv(sum([coord*base for (coord, base) in zip(self.coords, self.basis)]))

test/test_mv.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import unittest
2+
3+
import pytest
24
from sympy import Symbol
35
from galgebra.ga import Ga
46
from galgebra import utils
57

68
class TestMv(unittest.TestCase):
79

10+
def test_deprecations(self):
11+
ga, e_1, e_2, e_3 = Ga.build('e*1|2|3')
12+
with pytest.warns(DeprecationWarning):
13+
ga.mv_x
14+
with pytest.warns(DeprecationWarning):
15+
ga.mv_I
16+
817
def test_is_base(self):
918
"""
1019
Various tests on several multivectors.

0 commit comments

Comments
 (0)