Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
balintlaczko committed Sep 18, 2021
1 parent 789e036 commit 9f3f04e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_positive(self):
def test_negative(self):
assert scale_array(np.array([1, 2, 3]), -0.1, -0.3).all() == np.array([-0.1, -0.2, -0.3]).all()


class Test_generate_outfilename:
def test_increment_once(self):
f = open('testfile.txt', 'w')
Expand All @@ -60,4 +61,21 @@ def test_increment_twice(self):
os.remove("testfile_0.txt")


class Test_get_frame_planecount:
def test_3plane(self):
frame = np.random.rand(3, 1920, 1080)
assert get_frame_planecount(frame) == 3
def test_1plane(self):
frame = np.random.rand(1920, 1080)
assert get_frame_planecount(frame) == 1


class Test_frame2ms:
def test_expected(self):
assert frame2ms(1234, 56) == 22036
def test_unexpected(self):
assert frame2ms(1234.56, 78.9) == 15647



#%%

0 comments on commit 9f3f04e

Please sign in to comment.