def test_median(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_median.csv")
     try:
         self.assertEqual(self.calculator.median(my_population), expected_output)  # positive test
         self.assertNotEqual(self.calculator.median(my_population), (expected_output + 1))  # negative test
     except AssertionError as e:
         print("Median has Assertion Error:", e)
         assert 0
Beispiel #2
0
 def test_pop_correlation_coefficient(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_pop_correlation_coefficient.csv")
     self.assertEqual(
         self.calculator.pop_correlation_coefficient(my_population),
         expected_output)  # positive test
     self.assertNotEqual(
         self.calculator.pop_correlation_coefficient(my_population),
         (expected_output + 1))  # negative test
 def test_confidence_interval(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_confidence_interval.csv")
     try:
         self.assertEqual(self.calculator.confidence_interval(my_population), expected_output)  # positive test
         self.assertNotEqual(self.calculator.confidence_interval(my_population), (expected_output + 1))  # negative test
     except AssertionError as e:
         print("Confidence Interval has Assertion Error:", e)
         assert 0
Beispiel #4
0
 def test_variance(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_variance.csv")
     try:
         self.assertEqual(self.calculator.variance(my_population),
                          expected_output)  # positive test
         self.assertNotEqual(self.calculator.variance(my_population),
                             expected_output + 1)  # negative test
     except AssertionError as e:
         print("Variance has Assertion Error:", e)
         assert 0
Beispiel #5
0
 def test_pop_correlation_coefficient(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_pop_correlation_coefficient.csv")
     try:
         self.assertEqual(
             self.calculator.pop_correlation_coefficient(my_population),
             expected_output)  # positive test
         self.assertNotEqual(
             self.calculator.pop_correlation_coefficient(my_population),
             (expected_output + 1))  # negative test
     except AssertionError as e:
         print("Population Correlation Coefficient has Assertion Error:", e)
         assert 0
Beispiel #6
0
 def test_mean(self):
     my_population=read_population("population.csv")
     expected_output=read_answer("answer_mean.csv")
     self.assertEqual(self.calculator.mean(my_population),expected_output) #positive test
     self.assertNotEqual(self.calculator.mean(my_population),(expected_output+1)) #negative test
Beispiel #7
0
 def test_variance_sample_proportion(self):
     my_population = read_population("population.csv")
     # expected_output = read_answer("answer_variance_sample_proportion.csv")
     try:
         self.assertEqual(self.calculator.variance_sample_proportion(my_population),read_answer("answer_variance_sample_proportion.csv"))  # positive test
         self.assertNotEqual(self.calculator.variance_sample_proportion(my_population),(read_answer("answer_variance_sample_proportion.csv") + 1))  # negative test
     except AssertionError as e:
         print("Variance of Sample Proportion has Assertion Error:", e)
         assert 0
Beispiel #8
0
 def test_sample_sd(self):
     my_population = read_population("population.csv")
     self.assertEqual(self.calculator.sample_sd(my_population), read_answer("answer_sample_sd.csv"))  # positive test
     self.assertNotEqual(self.calculator.sample_sd(my_population),(read_answer("answer_sample_sd.csv") + 1.5))  # negative test