Exemple #1
0
    def are_answers_correctly_set(trial_conf, trial_data):
        df_force_answer = np.array(trial_data[list(FORCE_CLASS_COLS)].iloc[0])
        df_string_force_answer = FORCE_CLASS_COLS[df_force_answer.argmax()]
        conf_string_force_answer = gps.get_force_answer(trial_conf[0]["lf"])

        df_mass_answer = np.array(trial_data[list(MASS_CLASS_COLS)].iloc[0])
        df_string_mass_answer = MASS_CLASS_COLS[df_mass_answer.argmax()]
        conf_string_mass_answer = gps.get_mass_answer(trial_conf[0]["mass"])

        return (conf_string_force_answer
                == df_string_force_answer) and (conf_string_mass_answer
                                                == df_string_mass_answer)
Exemple #2
0
 def test_empty_list(self):
     forces = []
     with self.assertRaises(IndexError):
         gps.get_force_answer(forces)
Exemple #3
0
 def test_list_too_short(self):
     forces = [[0]]
     with self.assertRaises(IndexError):
         gps.get_force_answer(forces)
Exemple #4
0
 def test_same(self):
     forces = np.zeros((4, 4))
     self.assertEqual(gps.get_force_answer(forces), 'none')
Exemple #5
0
 def test_repel(self):
     forces = np.random.rand(3, 3)
     forces[0][1] *= -1
     self.assertEqual(gps.get_force_answer(forces), 'repel')
Exemple #6
0
 def test_attract(self):
     forces = np.random.rand(2, 2)
     self.assertEqual(gps.get_force_answer(forces), 'attract')