-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestlr.py
42 lines (32 loc) · 920 Bytes
/
testlr.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
import unittest
# import pytest
import numpy as np
import cv2
import time
import tracking as track
import jianzi as jz
import pygame
from pygame.locals import *
score = -1
class TestStringMethods(unittest.TestCase):
global score
jz.screen_init()
# check if the screen active
def test_screen(self):
self.assertEqual(pygame.display.get_caption()[0], "Play Balls!")
self.assertTrue(pygame.display.get_active())
# check if the image load right
def test_img(self):
self.assertNotEqual(jz.image, None)
self.assertNotEqual(jz.rec, None)
self.assertEqual(jz.img_radius, 35)
jz.init()
score = jz.score
def test_score(self):
self.assertEqual(score, 0)
self.assertEqual(jz.rec.centery, 1)
jz.update()
def test_update(self):
self.assertEqual(jz.score, 1)
if __name__ == '__main__':
unittest.main()