Beispiel #1
0
def test__merge_sections():
    default_sec = dw.DataBlockSection()

    sec_a = dw.DataBlockSection([], ntype=0, pid=-1)
    sec_b = dw.DataBlockSection([], ntype=0, pid=-1)
    dw._merge_sections(sec_a, sec_b)
    nt.eq_(sec_a, default_sec)

    sec_a = dw.DataBlockSection(range(10), ntype=1, pid=1)
    sec_b = dw.DataBlockSection(range(9, 20), ntype=10, pid=10)
    dw._merge_sections(sec_a, sec_b)
    nt.eq_(sec_a, default_sec)
    nt.eq_(sec_b.ids, list(range(20))) # Note: 9 is in this list from sec_a, not from sec_b
    nt.eq_(sec_b.ntype, 1)
    nt.eq_(sec_b.pid, 1)
Beispiel #2
0
def test_DataBlockSection_str():
    s = str(dw.DataBlockSection())
    nt.ok_('DataBlockSection' in s)