Exemple #1
0
 def test600_930ShouldRaiseExceptionOnNonNumericT(self):
     expectedString = "Sample.p:"
     mySample = SM.Sample(self.nominalN)
     with self.assertRaises(ValueError) as context:
         mySample.p(t="abc", tails=1)
     self.assertEquals(expectedString,
                       context.exception.args[0][0:len(expectedString)])
Exemple #2
0
 def test000_002_ShouldIntegrateSquare(self):
     s = SM.Sample(self.nominalN)
     self.assertAlmostEquals(s.integrate(0.0, 1.0, 1.0, lambda x, y: x**2),
                             1.0 / 3.0)
Exemple #3
0
 def test400_020_ShouldCalculateF(self):
     mySample = SM.Sample(self.nominalN)
     self.assertAlmostEquals(mySample.f(1, 5), 0.578703704)
Exemple #4
0
 def test400_010_ShouldCalculateFStarterCase(self):
     mySample = SM.Sample(self.nominalN)
     self.assertAlmostEquals(mySample.f(0, 5), 1, 4)
Exemple #5
0
 def test300_010_ShouldCalculateLHP(self):
     mySample = SM.Sample(self.nominalN)
     self.assertAlmostEquals(mySample.calculateConstant(5), 0.37960669, 4)
Exemple #6
0
 def test200_030_ShouldWorkOnHalfX(self):
     mySample = SM.Sample(self.nominalN)
     self.assertAlmostEquals(mySample.gamma(5.0 / 2.0), 1.329, 3)
Exemple #7
0
 def test600_060ShouldCalculateHighNLowT2TailEdgeCase(self):
     mySample = SM.Sample(20)
     self.assertAlmostEquals(mySample.p(0.2567, 2), 0.200, 3)
Exemple #8
0
 def test100_940_ShouldRaiseExceptionOnMissingN(self):
     expectedString = "Sample.__init__:"
     with self.assertRaises(ValueError) as context:
         SM.Sample()
     self.assertEquals(expectedString,
                       context.exception.args[0][0:len(expectedString)])
Exemple #9
0
 def test200_010_ShouldReturnUpperTerminationCondition(self):
     mySample = SM.Sample(self.nominalN)
     self.assertEquals(mySample.gamma(1), 1)
Exemple #10
0
 def test600_930ShouldRaiseExceptionInvalidTails(self):
     mySample = SM.Sample(self.nominalN)
     with self.assertRaises(ValueError) as context:
         mySample.p(t=self.nominalT, tails=0)
Exemple #11
0
 def test600_110ShouldCalculateCalculateWithDefaultTails(self):
     mySample = SM.Sample(7)
     self.assertAlmostEquals(mySample.p(1.8946), .950, 3)
Exemple #12
0
 def test600_100ShouldCalculateHighHighT2TailEdgeCase(self):
     mySample = SM.Sample(20)
     self.assertAlmostEquals(mySample.p(2.8453, 2), .990, 3)
Exemple #13
0
 def test600_090ShouldCalculateHighHighT1TailEdgeCase(self):
     mySample = SM.Sample(20)
     self.assertAlmostEquals(mySample.p(2.8453, 1), .995, 3)
Exemple #14
0
 def test600_080ShouldCalculateLowNHighT2EdgeCase(self):
     mySample = SM.Sample(3)
     self.assertAlmostEquals(mySample.p(5.8409, 2), .990, 3)
Exemple #15
0
 def test000_003_ShouldIntegrate100(self):
     s = SM.Sample(self.nominalN)
     self.assertAlmostEquals(
         s.integrate(0.0, 1.0, 1.0, lambda x, y: x**100), 1.0 / 101.0)
Exemple #16
0
 def test200_020_ShouldReturnLowerTerminationCondition(self):
     mySample = SM.Sample(self.nominalN)
     self.assertEquals(mySample.gamma(1.0 / 2.0), math.sqrt(math.pi))
Exemple #17
0
 def test100_010_ShouldConstruct(self):
     self.assertIsInstance(SM.Sample(self.nominalN), SM.Sample)
     # additional tests are for boundary value coverage
     self.assertIsInstance(SM.Sample(2), SM.Sample)
     self.assertIsInstance(SM.Sample(29), SM.Sample)
Exemple #18
0
 def test200_030_ShouldWorkOnIntegerX(self):
     mySample = SM.Sample(self.nominalN)
     self.assertEquals(mySample.gamma(5), 24)
Exemple #19
0
 def test600_010ShouldCalculateNominalCase1Tail(self):
     mySample = SM.Sample(7)
     self.assertAlmostEquals(mySample.p(1.8946, 1), .950, 3)
Exemple #20
0
 def test600_040ShouldCalculateLowNLowT2TailEdgeCase(self):
     mySample = SM.Sample(3)
     self.assertAlmostEquals(mySample.p(0.2767, 2), 0.200, 3)