Пример #1
0
 def test_sd(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_sd.csv")
     self.assertEqual(self.calculator.sd(my_population),
                      expected_output)  # positive test
     self.assertNotEqual(self.calculator.sd(my_population),
                         (expected_output + 1))  # negative test
Пример #2
0
 def test_variance(self):
     my_population = read_population("population.csv")
     expected_output = read_answer("answer_variance.csv")
     self.assertEqual(self.calculator.variance(my_population),
                      expected_output)  # positive test
     self.assertNotEqual(self.calculator.variance(my_population),
                         expected_output + 1)  # negative test
 def test_standardised_score(self):
     my_population = read_population("population.csv")
     expected_output = read_answer_list("answer_zscore.csv")
     self.assertListEqual(self.calculator.z_score(my_population),
                          expected_output)  # positive test
     self.assertNotEqual(
         self.calculator.z_score(my_population),
         (list(map(lambda x: x + 1, expected_output))))  # negative test
Пример #4
0
 def test_sample_mean(self):
     my_population = read_population("population.csv")
     self.assertEqual(
         self.calculator.sample_mean(my_population),
         read_answer("answer_sample_mean.csv"))  # positive test
     self.assertNotEqual(
         self.calculator.sample_mean(my_population),
         (read_answer("answer_sample_mean.csv") + 1))  # negative test
 def test_sample_mean(self):
     my_population = read_population("population.csv")
     try:
         self.assertEqual(self.calculator.sample_mean(my_population),read_answer("answer_sample_mean.csv"))  # positive test
         self.assertNotEqual(self.calculator.sample_mean(my_population),(read_answer("answer_sample_mean.csv") + 1))  # negative test
     except AssertionError as e:
         print("Sample Mean has Assertion Error:", e)
         assert 0
Пример #6
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
 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
Пример #8
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
Пример #10
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
 def test_variance_popu_proportion(self):
     my_population = read_population("population.csv")
     # expected_output = read_answer("answer_variance_popu_proportion.csv")
     self.assertEqual(
         self.calculator.variance_popu_proportion(my_population),
         read_answer(
             "answer_variance_popu_proportion.csv"))  # positive test
     self.assertNotEqual(
         self.calculator.variance_popu_proportion(my_population),
         (read_answer("answer_variance_popu_proportion.csv") +
          1))  # negative test
Пример #12
0
 def test_z_score(self):
     my_population = read_population("population.csv")
     expected_output = read_answer_list("answer_zscore.csv")
     try:
         self.assertListEqual(self.calculator.z_score(my_population),
                              expected_output)  # positive test
         self.assertNotEqual(
             self.calculator.z_score(my_population),
             (list(map(lambda x: x + 1, expected_output))))  # negative test
     except AssertionError as e:
         print("Z Score has Assertion Error:", e)
         assert 0
 def test_csv_reader(self):
     my_population = read_population("population.csv")
     expected_output = read_answer_list("answer_csv_reader.csv")
     try:
         self.assertListEqual(my_population,
                              expected_output)  # positive test
         self.assertNotEqual(
             my_population,
             (list(map(lambda x: x + 1, expected_output))))  # negative test
     except AssertionError as e:
         print("Csv Reader has Assertion Error:", e)
         assert 0
Пример #14
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