def test_copy_down(self, deepcopy, copy_hofs): seg = create_mock(["iter_asms", "info"]) info = create_mock(["up_flag"]) deepcopy.return_value = info copy_hofs.return_value = "hofs", None # Call ntools.eq_(path_combinator._copy_segment(seg, False, False, up=False), (info, "hofs", None)) # Tests copy_hofs.assert_called_once_with(seg.iter_asms.return_value, reverse=False)
def test_copy_down(self, copy_hofs): seg = create_mock(["iter_asms", "infoF"]) info = create_mock(["cons_dir_flag", "timestamp"]) info.timestamp = 12345 seg.infoF.return_value = info copy_hofs.return_value = "hofs", None, 1 # Call ntools.eq_(path_combinator._copy_segment(seg, False, False, cons_dir=True), (info, "hofs", None, 12345 + EXP_TIME_UNIT)) # Tests copy_hofs.assert_called_once_with(seg.iter_asms.return_value, reverse=False)
def test_copy_up(self, copy_hofs): seg = create_mock(["iter_asms", "infoF"]) info = create_mock(["up_flag"]) seg.infoF.return_value = info hofs = [] for _ in range(3): hof = create_mock(["xover"]) hof.xover = False hofs.append(hof) copy_hofs.return_value = hofs, None # Call ntools.eq_(path_combinator._copy_segment(seg, True, True), (info, hofs, None)) # Tests ntools.eq_(info.up_flag, True) copy_hofs.assert_called_once_with(seg.iter_asms.return_value, reverse=True) ntools.eq_(hofs[0].xover, True) ntools.eq_(hofs[1].xover, False) ntools.eq_(hofs[2].xover, True)
def test_copy_up(self, copy_hofs): seg = create_mock(["iter_asms", "infoF"]) info = create_mock(["cons_dir_flag", "timestamp"]) info.timestamp = 12345 seg.infoF.return_value = info hofs = [] for _ in range(3): hof = create_mock(["xover"]) hof.xover = False hofs.append(hof) copy_hofs.return_value = hofs, None, 0 # Call ntools.eq_(path_combinator._copy_segment(seg, True, True), (info, hofs, None, 12345 + EXP_TIME_UNIT)) # Tests ntools.eq_(info.cons_dir_flag, False) copy_hofs.assert_called_once_with(seg.iter_asms.return_value, reverse=True) ntools.eq_(hofs[0].xover, True) ntools.eq_(hofs[1].xover, False) ntools.eq_(hofs[2].xover, True)
def test_no_segment(self): ntools.eq_(path_combinator._copy_segment(None, False, False, "xovrs"), (None, None, float("inf"), float("inf")))