def test_speed_within_edge_lower2(): speed_limits = { "ideal_min": 5, "ideal_max": 8, "edge_min": 2, "edge_max": 13 } assert score(3, speed_limits) == 1 / 3
def test_speed_within_edge_upper(): speed_limits = { "ideal_min": 0, "ideal_max": 8, "edge_min": 0, "edge_max": 13 } assert score(9, speed_limits) == 0.8
def test_speed_within_edge_upper2(): speed_limits = { "ideal_min": 0, "ideal_max": 8, "edge_min": 0, "edge_max": 13 } assert score(12, speed_limits) == 12 * -0.2 - 13 * -0.2
def test_speed_outside_edge_ideal_same_bound_upper(): speed_limits = { "ideal_min": 0, "ideal_max": 13, "edge_min": 0, "edge_max": 13 } assert score(13, speed_limits) == 1
def test_speed_within_ideal(): speed_limits = { "ideal_min": 0, "ideal_max": 8, "edge_min": 0, "edge_max": 13 } assert score(2, speed_limits) == 1
def test_speed_outside_edge_lower(): speed_limits = { "ideal_min": 5, "ideal_max": 8, "edge_min": 3, "edge_max": 13 } assert score(1, speed_limits) == 0
def test_speed_outside_edge_upper(): speed_limits = { "ideal_min": 0, "ideal_max": 8, "edge_min": 0, "edge_max": 13 } assert score(14, speed_limits) == 0
def test_score_winning_and_losing_base_cases(self): self.assertEqual(score('xxx ', player='x'), 1) self.assertEqual(score('xxx ', player='o'), -1) self.assertEqual(score('o o o ', player='o'), 1) self.assertEqual(score('o o o ', player='x'), -1) self.assertEqual(score('x x x ', player='x'), 1) self.assertEqual(score('x x x ', player='o'), -1)
def run_run(solution, input): run = load_solution(solution) args = load_input(input) start = datetime.datetime.now() result = run(*args) result_done = datetime.datetime.now() print("result took: ", result_done - start) score = app.score(*result) score_done = datetime.datetime.now() print("score took: ", score_done - result_done) output = app.output(*result) print("Score: ", score) store_run(solution, input, score, output) return score, result
def test_neu_sentiment_score(self): text3 = "I am walking on the street" print("3rd test:") self.assertEqual(score(text3), None)
def test_neg_sentiment_score(self): text2 = "I am unhappy" print("2nd test:") self.assertEqual(score(text2), None)
def test_pos_sentiment_score(self): text1 = "I am happy" print("1st test:") self.assertEqual(score(text1), None)
def test_score_blank_board_is_tie(self): self.assertEqual(score(' ', player='o'), 0) self.assertEqual(score(' ', player='x'), 0)
def test_score_easy_board_can_win(self): self.assertEqual(score('oo xx ', player='o'), 1) self.assertEqual(score('oo xx ', player='x'), 1)
def test_score_tie_base_cases(self): self.assertEqual(score('xoooxxoxo', player='x'), 0) self.assertEqual(score('xoooxxoxo', player='o'), 0)