@@ -261,4 +261,41 @@ def test_long_non_mating_pv(self):
261261 self .assertEqual (result , target )
262262
263263
264+ class test_get_nags (unittest .TestCase ):
265+
266+ def test_zero (self ):
267+ judgment = {'playedeval' : 0 , 'besteval' : 0 }
268+ result = annotator .get_nags (judgment )
269+ self .assertEqual (result , [])
270+
271+ def test_negative (self ):
272+ judgment = {'playedeval' : 0 , 'besteval' : - 10 }
273+ result = annotator .get_nags (judgment )
274+ self .assertEqual (result , [])
275+
276+ def test_float (self ):
277+ judgment = {'playedeval' : 0.001 , 'besteval' : - 10.05 }
278+ result = annotator .get_nags (judgment )
279+ self .assertEqual (result , [])
280+
281+ def test_blunder (self ):
282+ judgment = {'playedeval' : 0 , 'besteval' : 350 }
283+ result = annotator .get_nags (judgment )
284+ self .assertEqual (result , [chess .pgn .NAG_BLUNDER ])
285+
286+ def test_mistake (self ):
287+ judgment = {'playedeval' : 0 , 'besteval' : 200 }
288+ result = annotator .get_nags (judgment )
289+ self .assertEqual (result , [chess .pgn .NAG_MISTAKE ])
290+
291+ def test_dubious (self ):
292+ judgment = {'playedeval' : 0 , 'besteval' : 100 }
293+ result = annotator .get_nags (judgment )
294+ self .assertEqual (result , [chess .pgn .NAG_DUBIOUS_MOVE ])
295+
296+ def test_typeerror (self ):
297+ judgment = {'playedeval' : 0 , 'besteval' : 'foo' }
298+ self .assertRaises (TypeError , annotator .get_nags , judgment )
299+
300+
264301# vim: ft=python expandtab smarttab shiftwidth=4 softtabstop=4 fileencoding=UTF-8:
0 commit comments