You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
924 B

#coding:utf-8
import unittest
import sys
sys.path.append('../src')
from boat import Boat
from position import Position
from custom_exception.nothing_to_compare_error import *
class BoatUTest(unittest.TestCase):
def test_get_temp_mean(self):
temps = [0.0, 25.0, 50.0, 75.0, 100.0]
test_boat = Boat("0", "50", "0", "0", "0", temps, [])
self.assertEqual(test_boat.get_temp_mean(), 50)
def test_get_northiest_coords(self):
center = Position(0, 0)
north = Position(90, 0)
south = Position(-90, 0)
test_boat = Boat("0", "Test", "0", "0", "0", [], [center, north, south])
test_broken_boat = Boat("0", "Broken", "0", "0", "0", [], [])
self.assertEqual(test_boat.get_northiest_coords(), north)
with self.assertRaises(NothingToCompareError):
test_broken_boat.get_northiest_coords()
if __name__ == '__main__':
unittest.main()