Esempio n. 1
0
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())
Esempio n. 2
0
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
Esempio n. 3
0
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))
Esempio n. 7
0
 def test_02(self):
     actor1 = 46866
     actor2 = 1640
     self.assertTrue(lab.did_x_and_y_act_together(self.data, actor1, actor2))
Esempio n. 8
0
 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))
Esempio n. 9
0
 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))
Esempio n. 10
0
 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))
Esempio n. 11
0
 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))
Esempio n. 12
0
def better_together(d):
	return lab.did_x_and_y_act_together(small_data, d["actor_1"], d["actor_2"])
Esempio n. 13
0
 def test_case_2(self):
     """ Actors did not act togather"""
     self.assertFalse(lab.did_x_and_y_act_together(self.data, 1640, 1532))
Esempio n. 14
0
 def test_case_1(self):
     """ actors did actor togather"""
     self.assertTrue(lab.did_x_and_y_act_together(self.data, 4724, 2876))
Esempio n. 15
0
 def test_01(self):
     actor1 = 2876
     actor2 = 1234
     self.assertFalse(
         lab.did_x_and_y_act_together(self.data, actor1, actor2))
Esempio n. 16
0
 def test_2(self):
     actor1 = 4724
     actor2 = 2876
     self.assertEqual(lab.did_x_and_y_act_together(self.data, actor1, actor2),True)
Esempio n. 17
0
 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))
Esempio n. 18
0
 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))
Esempio n. 19
0
 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))
Esempio n. 20
0
 def test_01(self):
     actor1 = 4724
     actor2 = 4025
     self.assertFalse(lab.did_x_and_y_act_together(self.data, actor1, actor2))