subhdotsol commited on
Commit
a5aa26d
·
1 Parent(s): 613f214

test(graders): add easy_grader tests — empty, good, bad episode and range check

Browse files
Files changed (1) hide show
  1. tests/test_graders.py +17 -0
tests/test_graders.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from graders.easy_grader import grade_easy
2
+
3
+ def test_easy_grader():
4
+ # Empty history
5
+ assert grade_easy([]) == 0.0
6
+
7
+ # Successful attack
8
+ history = [{"attack_success_estimate": 0.9}]
9
+ assert grade_easy(history) == 0.9
10
+
11
+ # Failed attack
12
+ history = [{"attack_success_estimate": 0.1}]
13
+ assert grade_easy(history) == 0.1
14
+
15
+ # Range check
16
+ history = [{"attack_success_estimate": 1.5}]
17
+ assert grade_easy(history) == 1.0