def test_run_do_not_modify_model_inplace(self): state = Mock() state.is_interruption_requested.return_value = True result = run_mds(*(self.args + (state,))) state.set_partial_result.assert_called_once() self.assertIsNot(self.init, result.embedding) self.assertTrue((self.init != result.embedding).any())
def test_run_mds(self): state = Mock() state.is_interruption_requested.return_value = False result = run_mds(*(self.args + (state,))) array = np.array([[-2.69280967, 0.32544313], [-2.72409383, -0.21287617], [-2.9022707, -0.13465859], [-2.75267253, -0.33899134], [-2.74108069, 0.35393209]]) np.testing.assert_almost_equal(array, result.embedding[:5]) state.set_status.assert_called_once_with("Running...") self.assertGreater(state.set_partial_result.call_count, 2) self.assertGreater(state.set_progress_value.call_count, 2)