-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.py
46 lines (38 loc) · 1.6 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""Unit Tests for Student Submission"""
import matplotlib.pyplot as plt
import matplotlib.testing.compare as test
import numpy as np
from PIL import Image
import unittest
# import student_solution
class Test(unittest.TestCase):
def test_JandJ(self):
correct = Image.open('./images/jj_earnings_example.png')
student = Image.open('./images/jj_earnings.png')
correct_arr = np.asarray(correct)
student_arr = np.asarray(student)
rms_value = test.calculate_rms(correct_arr, student_arr)
self.assertTrue(rms_value <= 10)
def test_BNV(self):
correct = Image.open('./images/bnp_example.png')
student = Image.open('./images/bivariate_normal_plot.png')
correct_arr = np.asarray(correct)
student_arr = np.asarray(student)
rms_value = test.calculate_rms(correct_arr, student_arr)
self.assertTrue(rms_value <= 10)
def test_ABV(self):
correct = Image.open('./images/abv_example.png')
student = Image.open('./images/ABV_histograms.png')
correct_arr = np.asarray(correct)
student_arr = np.asarray(student)
rms_value = test.calculate_rms(correct_arr, student_arr)
self.assertTrue(rms_value <= 10)
def test_ABV(self):
correct = Image.open('./images/ndw_example.png')
student = Image.open('./images/normally_distributed_wave.png')
correct_arr = np.asarray(correct)
student_arr = np.asarray(student)
rms_value = test.calculate_rms(correct_arr, student_arr)
self.assertTrue(rms_value <= 10)
if __name__ == "__main__":
unittest.main()