Beispiel #1
0
def test_pushheader_positional():

    table1 = (('a', 1), ('b', 2))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar')
    expect2 = (('foo', 'bar'), ('a', 1), ('b', 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with many fields
    table1 = (('a', 1, 11, 111, 1111), ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2', 'foo3')
    expect2 = (('foo', 'bar', 'foo1', 'foo2', 'foo3'), ('a', 1, 11, 111, 1111),
               ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too few fields in header
    table1 = (('a', 1, 11, 111, 1111), ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2')
    expect2 = (('foo', 'bar', 'foo1', 'foo2'), ('a', 1, 11, 111, 1111),
               ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too many fields in header
    table1 = (('a', 1, 11, 111, 1111), ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2', 'foo3', 'foo4')
    expect2 = (('foo', 'bar', 'foo1', 'foo2', 'foo3', 'foo4'),
               ('a', 1, 11, 111, 1111), ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?
Beispiel #2
0
def test_pushheader_positional():

    table1 = (("a", 1), ("b", 2))
    table2 = pushheader(table1, "foo", "bar")  # positional arguments instead of list
    expect2 = (("foo", "bar"), ("a", 1), ("b", 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with many fields
    table1 = (("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    table2 = pushheader(table1, "foo", "bar", "foo1", "foo2", "foo3")  # positional arguments instead of list
    expect2 = (("foo", "bar", "foo1", "foo2", "foo3"), ("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too few fields in header
    table1 = (("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    table2 = pushheader(table1, "foo", "bar", "foo1", "foo2")  # positional arguments instead of list
    expect2 = (("foo", "bar", "foo1", "foo2"), ("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too many fields in header
    table1 = (("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    table2 = pushheader(table1, "foo", "bar", "foo1", "foo2", "foo3", "foo4")  # positional arguments instead of list
    expect2 = (("foo", "bar", "foo1", "foo2", "foo3", "foo4"), ("a", 1, 11, 111, 1111), ("b", 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?
Beispiel #3
0
def test_pushheader_empty():

    table1 = (('a', 1),)
    table2 = pushheader(table1, ['foo', 'bar'])
    expect2 = (('foo', 'bar'),
               ('a', 1))
    ieq(expect2, table2)

    table1 = tuple()
    table2 = pushheader(table1, ['foo', 'bar'])
    expect2 = (('foo', 'bar'),)
    ieq(expect2, table2)
Beispiel #4
0
def test_pushheader():

    table1 = (('a', 1), ('b', 2))
    table2 = pushheader(table1, ['foo', 'bar'])
    expect2 = (('foo', 'bar'), ('a', 1), ('b', 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?
Beispiel #5
0
def test_pushheader_empty():

    table1 = (("a", 1),)
    table2 = pushheader(table1, ["foo", "bar"])
    expect2 = (("foo", "bar"), ("a", 1))
    ieq(expect2, table2)

    table1 = tuple()
    table2 = pushheader(table1, ["foo", "bar"])
    expect2 = (("foo", "bar"),)
    ieq(expect2, table2)

    table1 = tuple()
    table2 = pushheader(table1, "foo", "bar")
    expect2 = (("foo", "bar"),)
    ieq(expect2, table2)
Beispiel #6
0
def test_pushheader():

    table1 = (("a", 1), ("b", 2))
    table2 = pushheader(table1, ["foo", "bar"])
    expect2 = (("foo", "bar"), ("a", 1), ("b", 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?
Beispiel #7
0
def test_pushheader_positional():

    table1 = (('a', 1),
              ('b', 2))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar')
    expect2 = (('foo', 'bar'),
               ('a', 1),
               ('b', 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with many fields
    table1 = (('a', 1, 11, 111, 1111),
              ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2', 'foo3')
    expect2 = (('foo', 'bar', 'foo1', 'foo2', 'foo3'),
               ('a', 1, 11, 111, 1111),
               ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too few fields in header
    table1 = (('a', 1, 11, 111, 1111),
              ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2')
    expect2 = (('foo', 'bar', 'foo1', 'foo2'),
               ('a', 1, 11, 111, 1111),
               ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?

    # test with too many fields in header
    table1 = (('a', 1, 11, 111, 1111),
              ('b', 2, 22, 222, 2222))
    # positional arguments instead of list
    table2 = pushheader(table1, 'foo', 'bar', 'foo1', 'foo2', 'foo3', 'foo4')
    expect2 = (('foo', 'bar', 'foo1', 'foo2', 'foo3', 'foo4'),
               ('a', 1, 11, 111, 1111),
               ('b', 2, 22, 222, 2222))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?
Beispiel #8
0
def test_pushheader():

    table1 = (('a', 1),
              ('b', 2))
    table2 = pushheader(table1, ['foo', 'bar'])
    expect2 = (('foo', 'bar'),
               ('a', 1),
               ('b', 2))
    ieq(expect2, table2)
    ieq(expect2, table2)  # can iterate twice?