Skip to content

Commit

Permalink
fix syntax error (#101)
Browse files Browse the repository at this point in the history
* fix syntax error in set equal parameter and adds test for set_equal_param of distribute models
This commit adds a test for changes introduced in commit 0b502f177ac8cbb63dc2135d170fee58d .
  • Loading branch information
matteofrigo authored Aug 18, 2020
1 parent 9bd7038 commit dcb0916
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dmipy/distributions/distribute_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ def set_equal_parameter(self, parameter_name_in, parameter_name_out):
try:
self.parameter_ranges[param]
except KeyError:
print("{} does not exist or has already been fixed.").format(
param)
print("{} does not exist or has already been fixed.".format(
param))
return None
model, name = self._parameter_map[parameter_name_out]
self.parameter_links.append([model, name, parameter_equality, [
Expand Down
15 changes: 15 additions & 0 deletions dmipy/distributions/tests/test_distribute_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,18 @@ def test_C4_watson_gamma_equals_gamma_watson():

assert_array_almost_equal(watsongammacyl(scheme, **params2),
gammawatsoncyl(scheme, **params1), 5)


def test_set_equal_param():
cylinder = cylinder_models.C2CylinderStejskalTannerApproximation()
watsoncyl = distribute_models.SD1WatsonDistributed([cylinder])
p1 = 'C2CylinderStejskalTannerApproximation_1_lambda_par'
p2 = 'C2CylinderStejskalTannerApproximation_1_diameter'
watsoncyl.set_equal_parameter(p1, p2)

isnone = False
reset = watsoncyl.set_equal_parameter(p1, p2)
if reset is None:
isnone = True

assert_equal(isnone, True)

0 comments on commit dcb0916

Please sign in to comment.