def run_test(input_data): running_time = time.time() # Demux to the correct function try: if input_data["function"] == "pair": result = lab.did_x_and_y_act_together(small_data, input_data["actor_1"], input_data["actor_2"]) # Actors with a given bacon number elif input_data["function"] == "set": result = lab.get_actors_with_bacon_number(small_data, input_data["n"]) # Paths in a small database elif input_data["function"] == "path_small": result = lab.get_bacon_path(small_data, input_data["actor_id"]) # Paths in a large database elif input_data["function"] == "path": result = lab.get_bacon_path(large_data, input_data["actor_id"]) running_time = time.time() - running_time return (running_time, result) except Exception: return ('error', traceback.format_exc())
def run_test(input_data): running_time = time.time() # Demux to the correct function try: if input_data["function"] == "pair": result = lab.did_x_and_y_act_together(small_data, input_data["actor_1"], input_data["actor_2"]) # Actors with a given bacon number elif input_data["function"] == "set": result = lab.get_actors_with_bacon_number(small_data, input_data["n"]) # Paths in a small database elif input_data["function"] == "path_small": result = lab.get_bacon_path(small_data, input_data["actor_id"]) # Paths in a large database elif input_data["function"] == "path": result = lab.get_bacon_path(large_data, input_data["actor_id"]) running_time = time.time() - running_time except ValueError as e: return e.message except: return traceback.format_exc() return running_time, result
def better_together(d): return lab.did_x_and_y_act_together(small_data, d["actor_1"], d["actor_2"])
def test_05(self): # Simple test, same actor actor1 = self.names["Kenneth McMillan"] actor2 = self.names["Helene Lapiower"] self.assertFalse(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_04(self): # Simple test, same actor actor1 = self.names["Carole Bouquet"] actor2 = self.names["Stanislas Crevillen"] self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_01(self): actor = 1640 self.assertTrue(lab.did_x_and_y_act_together(self.data,actor,actor))
def test_02(self): actor1 = 46866 actor2 = 1640 self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_02(self): # Simple test, two actors who had not acted together actor1 = 4724 actor2 = 16935 self.assertFalse( lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_acted_together_03(self): # same actor actor1 = 1532 actor2 = 1532 self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_acted_together_02(self): # two actors who had not acted together actor1 = 1532 actor2 = 46866 self.assertFalse( lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_acted_together_01(self): # two actors who acted together actor1 = 1532 actor2 = 4724 self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_case_2(self): """ Actors did not act togather""" self.assertFalse(lab.did_x_and_y_act_together(self.data, 1640, 1532))
def test_case_1(self): """ actors did actor togather""" self.assertTrue(lab.did_x_and_y_act_together(self.data, 4724, 2876))
def test_01(self): actor1 = 2876 actor2 = 1234 self.assertFalse( lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_2(self): actor1 = 4724 actor2 = 2876 self.assertEqual(lab.did_x_and_y_act_together(self.data, actor1, actor2),True)
def test_01(self): # Simple test, two actors who acted together actor1 = 4724 actor2 = 9210 self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test2(self): # Simple test, two actors who had not acted together actor1 = 1532 actor2 = 1640 self.assertFalse( lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_03(self): # Simple test, same actor actor1 = 4724 actor2 = 4724 self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
def test_01(self): actor1 = 4724 actor2 = 4025 self.assertFalse(lab.did_x_and_y_act_together(self.data, actor1, actor2))