Skip to content

Commit a3be237

Browse files
committed
duplicate a setProfile test
1 parent b14acbf commit a3be237

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_contribution.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def setUp(self):
3434
self.fitcontribution = FitContribution("test")
3535
return
3636

37+
# Duplicate test due to name change of setProfile to set_profile
3738
def testSetProfile(self):
3839
fc = self.fitcontribution
3940
profile = self.profile
@@ -55,6 +56,27 @@ def testSetProfile(self):
5556
self.assertFalse(fc2._reseq is None)
5657
return
5758

59+
def test_set_profile(self):
60+
fc = self.fitcontribution
61+
profile = self.profile
62+
fc.set_profile(self.profile)
63+
# verify standard profile setup
64+
self.assertTrue(fc.profile is profile)
65+
self.assertTrue(fc.x.par is profile.xpar)
66+
self.assertTrue(fc.y.par is profile.ypar)
67+
self.assertTrue(fc.dy.par is profile.dypar)
68+
self.assertTrue(fc._eq is None)
69+
self.assertTrue(fc._reseq is None)
70+
# check type checking
71+
fc1 = FitContribution("test1")
72+
self.assertRaises(TypeError, fc1.set_profile, "invalid")
73+
# check if residual equation is set up when possible
74+
fc2 = FitContribution("test2")
75+
fc2.set_equation("A * x")
76+
fc2.set_profile(profile)
77+
self.assertFalse(fc2._reseq is None)
78+
return
79+
5880
def testAddProfileGenerator(self):
5981
fc = self.fitcontribution
6082
gen = self.gen

0 commit comments

Comments
 (0)