Skip to content

Commit

Permalink
Close #8
Browse files Browse the repository at this point in the history
  • Loading branch information
marijanbeg committed Dec 16, 2016
1 parent 0644cf6 commit a913f95
Show file tree
Hide file tree
Showing 15 changed files with 79 additions and 79 deletions.
2 changes: 1 addition & 1 deletion micromagneticmodel/drivers/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ def drive(self):
raise NotImplementedError

@property
def script(self):
def _script(self):
raise NotImplementedError
2 changes: 1 addition & 1 deletion micromagneticmodel/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ def m(self, value):
raise TypeError("Unsupported type(m)={}".format(type(value)))

@property
def script(self):
def _script(self):
raise NotImplementedError
18 changes: 9 additions & 9 deletions micromagneticmodel/tests/test_damping.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ def test_init_invalid_args(self):
def test_repr_latex_(self):
for alpha in self.valid_args:
damping = mm.Damping(alpha)
latex_str = damping._repr_latex_()
latex = damping._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert '\\alpha' in latex_str
assert '\mathbf{m}' in latex_str
assert '\\frac' in latex_str
assert '\\times' in latex_str
assert latex_str.count('\partial') == 2
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert '\\alpha' in latex
assert '\mathbf{m}' in latex
assert '\\frac' in latex
assert '\\times' in latex
assert latex.count('\partial') == 2

def test_name(self):
for alpha in self.valid_args:
Expand All @@ -51,4 +51,4 @@ def test_script(self):
for alpha in self.valid_args:
damping = mm.Damping(alpha)
with pytest.raises(NotImplementedError):
script = damping.script
script = damping._script
20 changes: 10 additions & 10 deletions micromagneticmodel/tests/test_demag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
class TestDemag:
def test_repr_latex_(self):
demag = mm.Demag()
latex_str = demag._repr_latex_()
latex = demag._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert '\\mu_{0}' in latex_str
assert '\mathbf{H}_\\text{d}' in latex_str
assert '\mathbf{m}' in latex_str
assert '\cdot' in latex_str
assert 'M_\\text{s}' in latex_str
assert '\\frac{1}{2}' in latex_str
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert '\\mu_{0}' in latex
assert '\mathbf{H}_\\text{d}' in latex
assert '\mathbf{m}' in latex
assert '\cdot' in latex
assert 'M_\\text{s}' in latex
assert '\\frac{1}{2}' in latex

def test_name(self):
demag = mm.Demag()
Expand All @@ -28,4 +28,4 @@ def test_repr(self):
def test_script(self):
demag = mm.Demag()
with pytest.raises(NotImplementedError):
script = demag.script
script = demag._script
2 changes: 1 addition & 1 deletion micromagneticmodel/tests/test_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test_drive(self):

def test_script(self):
with pytest.raises(NotImplementedError):
script = self.driver.script
script = self.driver._script
36 changes: 18 additions & 18 deletions micromagneticmodel/tests/test_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,28 +54,28 @@ def test_iadd(self):

def test_repr_latex(self):
dynamics = mm.Dynamics()
latex_str = dynamics._repr_latex_()
assert latex_str[0] == latex_str[-1] == '$'
assert latex_str.count('$') == 2
assert '\\frac' in latex_str
assert latex_str[-2] == '0'
latex = dynamics._repr_latex_()
assert latex[0] == latex[-1] == '$'
assert latex.count('$') == 2
assert '\\frac' in latex
assert latex[-2] == '0'

for term in self.terms:
dynamics._add(term)

latex_str = dynamics._repr_latex_()
latex = dynamics._repr_latex_()

assert latex_str[0] == latex_str[-1] == '$'
assert latex_str.count('$') == 2
assert '-\gamma' in latex_str
assert '\mathbf{m}' in latex_str
assert '\mathbf{H}_\\text{eff}' in latex_str
assert '\\times' in latex_str
assert '\\alpha' in latex_str
assert latex_str.count('-') == 1
assert latex_str.count('+') == 1
assert latex_str.count('=') == 1
assert latex_str.count('\partial') == 4
assert latex[0] == latex[-1] == '$'
assert latex.count('$') == 2
assert '-\gamma' in latex
assert '\mathbf{m}' in latex
assert '\mathbf{H}_\\text{eff}' in latex
assert '\\times' in latex
assert '\\alpha' in latex
assert latex.count('-') == 1
assert latex.count('+') == 1
assert latex.count('=') == 1
assert latex.count('\partial') == 4

def test_add_exception(self):
dynamics = mm.Dynamics()
Expand Down Expand Up @@ -111,4 +111,4 @@ def test_getattr_error(self):
def test_script(self):
dynamics = mm.Dynamics()
with pytest.raises(NotImplementedError):
script = dynamics.script
script = dynamics._script
14 changes: 7 additions & 7 deletions micromagneticmodel/tests/test_exchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ def test_init_invalid_args(self):
def test_repr_latex_(self):
for A in self.valid_args:
exchange = mm.Exchange(A)
latex_str = exchange._repr_latex_()
latex = exchange._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert '\\nabla' in latex_str
assert 'A' in latex_str
assert latex_str.count('+') == 2
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert '\\nabla' in latex
assert 'A' in latex
assert latex.count('+') == 2

def test_name(self):
for A in self.valid_args:
Expand All @@ -48,4 +48,4 @@ def test_script(self):
for A in self.valid_args:
exchange = mm.Exchange(A)
with pytest.raises(NotImplementedError):
script = exchange.script
script = exchange._script
2 changes: 1 addition & 1 deletion micromagneticmodel/tests/test_hamiltonian.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@ def test_getattr_error(self):
def test_script(self):
hamiltonian = mm.Hamiltonian()
with pytest.raises(NotImplementedError):
script = hamiltonian.script
script = hamiltonian._script
16 changes: 8 additions & 8 deletions micromagneticmodel/tests/test_precession.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ def test_init_invalid_args(self):
def test_repr_latex_(self):
for gamma in self.valid_args:
precession = mm.Precession(gamma)
latex_str = precession._repr_latex_()
latex = precession._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert '\gamma' in latex_str
assert '\mathbf{m}' in latex_str
assert '\mathbf{H}_\\text{eff}' in latex_str
assert '\\times' in latex_str
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert '\gamma' in latex
assert '\mathbf{m}' in latex
assert '\mathbf{H}_\\text{eff}' in latex
assert '\\times' in latex

def test_name(self):
for gamma in self.valid_args:
Expand All @@ -49,4 +49,4 @@ def test_script(self):
for gamma in self.valid_args:
precession = mm.Precession(gamma)
with pytest.raises(NotImplementedError):
script = precession.script
script = precession._script
20 changes: 10 additions & 10 deletions micromagneticmodel/tests/test_stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ def test_repr_latex_(self):
for arg in self.valid_args:
u, beta = arg
stt = mm.STT(u, beta)
latex_str = stt._repr_latex_()
latex = stt._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert '\\beta' in latex_str
assert '\mathbf{m}' in latex_str
assert '\mathbf{u}' in latex_str
assert '\\times' in latex_str
assert '\\boldsymbol' in latex_str
assert '\\nabla' in latex_str
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert '\\beta' in latex
assert '\mathbf{m}' in latex
assert '\mathbf{u}' in latex
assert '\\times' in latex
assert '\\boldsymbol' in latex
assert '\\nabla' in latex

def test_name(self):
for arg in self.valid_args:
Expand All @@ -69,4 +69,4 @@ def test_script(self):
u, beta = arg
stt = mm.STT(u, beta)
with pytest.raises(NotImplementedError):
script = stt.script
script = stt._script
2 changes: 1 addition & 1 deletion micromagneticmodel/tests/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def test_script(self):
system = mm.System(name="test_sim")

with pytest.raises(NotImplementedError):
script = system.script
script = system._script
18 changes: 9 additions & 9 deletions micromagneticmodel/tests/test_uniaxialanisotropy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def test_init_invalid_args(self):
def test_repr_latex(self):
for K, u in self.valid_args:
anisotropy = mm.UniaxialAnisotropy(K, u)
latex_str = anisotropy._repr_latex_()
latex = anisotropy._repr_latex_()

# Assert some characteristics of LaTeX string.
assert isinstance(latex_str, str)
assert latex_str[0] == latex_str[-1] == '$'
assert 'K' in latex_str
assert '\mathbf{u}' in latex_str
assert '\mathbf{m}' in latex_str
assert '^{2}' in latex_str
assert '\cdot' in latex_str
assert isinstance(latex, str)
assert latex[0] == latex[-1] == '$'
assert 'K' in latex
assert '\mathbf{u}' in latex
assert '\mathbf{m}' in latex
assert '^{2}' in latex
assert '\cdot' in latex

def test_name(self):
for K, u in self.valid_args:
Expand All @@ -63,4 +63,4 @@ def test_script(self):
for K, u in self.valid_args:
anisotropy = mm.UniaxialAnisotropy(K, u)
with pytest.raises(NotImplementedError):
script = anisotropy.script
script = anisotropy._script
2 changes: 1 addition & 1 deletion micromagneticmodel/tests/test_zeeman.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def test_script(self):
for H in self.valid_args:
zeeman = mm.Zeeman(H)
with pytest.raises(NotImplementedError):
script = zeeman.script
script = zeeman._script
2 changes: 1 addition & 1 deletion micromagneticmodel/util/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __radd__(self, other):
return other

@property
def script(self):
def _script(self):
"""This method should be provided by the specific micromagnetic
calculator"""
raise NotImplementedError
2 changes: 1 addition & 1 deletion micromagneticmodel/util/termsum.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __iadd__(self, other):
return self

@property
def script(self):
def _script(self):
"""This method should be provided by the specific micromagnetic
calculator"""
raise NotImplementedError

0 comments on commit a913f95

Please sign in to comment.