def test_pcbs_from_future(self): path_policy = MagicMock(spec_set=['history_limit']) path_policy.history_limit = 3 pth_str = PathStore(path_policy) pth_str.candidates = [MagicMock(spec_set=['pcb', 'delay_time', 'last_seen_time']) for i in range(5)] for i in range(5): pcb = MagicMock(spec_set=['get_timestamp']) pcb.get_timestamp.return_value = 2 pth_str.candidates[i].pcb = pcb pth_str.candidates[i].last_seen_time = i pth_str._update_all_delay_time() for i in range(5): pth_str.candidates[i].pcb.get_timestamp.assert_called_once_with() ntools.assert_true(pth_str.candidates[i].delay_time > 0)
def test_basic(self): path_policy = MagicMock(spec_set=['history_limit']) path_policy.history_limit = 3 pth_str = PathStore(path_policy) pth_str.candidates = [MagicMock(spec_set=['pcb', 'delay_time', 'last_seen_time']) for i in range(5)] for i in range(5): pcb = MagicMock(spec_set=['get_timestamp']) pcb.get_timestamp.return_value = 0 pth_str.candidates[i].pcb = pcb pth_str.candidates[i].last_seen_time = 2 * i + 2 pth_str._update_all_delay_time() for i in range(5): pth_str.candidates[i].pcb.get_timestamp.assert_called_once_with() ntools.assert_almost_equal(pth_str.candidates[i].delay_time, ((2 * i + 2) / 10))
def test_basic(self): path_policy = MagicMock(spec_set=['history_limit']) path_policy.history_limit = 3 pth_str = PathStore(path_policy) pth_str._update_all_disjointness = MagicMock(spec_set=[]) pth_str._update_all_delay_time = MagicMock(spec_set=[]) pth_str.candidates = [MagicMock(spec_set=['update_fidelity']) for i in range(5)] pth_str._update_all_fidelity() pth_str._update_all_disjointness.assert_called_once_with() pth_str._update_all_delay_time.assert_called_once_with() for i in range(5): pth_str.candidates[i].update_fidelity.assert_called_once_with( path_policy)