Skip to content

Commit 5374617

Browse files
committed
add bad test
1 parent b6c7a20 commit 5374617

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

tests/__init__.py

Whitespace-only changes.

tests/test_basic.py

+42
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,47 @@
1+
import numpy as np
2+
import magpylib as magpy
13
import magpylib_material_response
4+
from magpylib_material_response.demag import apply_demag
5+
from magpylib_material_response.meshing import mesh_Cuboid
26

37

48
def test_version():
59
assert isinstance(magpylib_material_response.__version__, str)
10+
11+
12+
def test_susceptibility_inputs():
13+
"""
14+
test if different xi inputs give the same result
15+
"""
16+
17+
zone = magpy.magnet.Cuboid(
18+
dimension=(1,1,1),
19+
polarization=(0,0,1),
20+
)
21+
mesh = mesh_Cuboid(zone, (2,2,2))
22+
23+
dm1 = apply_demag(mesh, susceptibility=4)
24+
dm2 = apply_demag(mesh, susceptibility=(4,4,4))
25+
dm3 = apply_demag(mesh, susceptibility=[4]*8)
26+
dm4 = apply_demag(mesh, susceptibility=[(4,4,4)]*8)
27+
28+
zone = magpy.magnet.Cuboid(
29+
dimension=(1,1,1),
30+
polarization=(0,0,1),
31+
)
32+
zone.susceptibility = 4
33+
mesh = mesh_Cuboid(zone, (2,2,2))
34+
dm5 = apply_demag(mesh)
35+
36+
zone = magpy.magnet.Cuboid(
37+
dimension=(1,1,1),
38+
polarization=(0,0,1),
39+
)
40+
zone.susceptibility = (4,4,4)
41+
mesh = mesh_Cuboid(zone, (2,2,2))
42+
dm6 = apply_demag(mesh)
43+
44+
b1 = dm1.getB((1,2,3))
45+
for dm in [dm2,dm3,dm4,dm5,dm6]:
46+
bb = dm.getB((1,2,3))
47+
np.testing.assert_allclose(b1,bb)

0 commit comments

Comments
 (0)