Exemplo n.º 1
0
 def test_maxsize_prop_setter(self):
     tbl = HeaderTable()
     exp = int(HeaderTable.DEFAULT_SIZE / 2)
     tbl.maxsize = exp
     assert tbl.resized is True
     assert tbl.maxsize == exp
     tbl.resized = False
     tbl.maxsize = exp
     assert tbl.resized is False
     assert tbl.maxsize == exp
Exemplo n.º 2
0
 def test_maxsize_prop_setter(self):
     tbl = HeaderTable()
     exp = int(HeaderTable.DEFAULT_SIZE / 2)
     tbl.maxsize = exp
     assert tbl.resized == True
     assert tbl.maxsize == exp
     tbl.resized = False
     tbl.maxsize = exp
     assert tbl.resized == False
     assert tbl.maxsize == exp
Exemplo n.º 3
0
 def test_add_to_large(self):
     tbl = HeaderTable()
     # Max size to small to hold the value we specify
     tbl.maxsize = 1
     tbl.add(b'TestName', b'TestValue')
     # Table length should be 0
     assert len(tbl.dynamic_entries) == 0
Exemplo n.º 4
0
 def test_add_to_large(self):
     tbl = HeaderTable()
     # Max size to small to hold the value we specify
     tbl.maxsize = 1
     tbl.add(b'TestName', b'TestValue')
     # Table length should be 0
     assert len(tbl.dynamic_entries) == 0
Exemplo n.º 5
0
    def test_shrink_maxsize(self):
        tbl = HeaderTable()
        for i in range(3):
            tbl.add(b'TestName', b'TestValue')

        assert tbl._current_size == 147
        tbl.maxsize = 146
        assert len(tbl.dynamic_entries) == 2
        assert tbl._current_size == 98
Exemplo n.º 6
0
    def test_shrink_maxsize(self):
        tbl = HeaderTable()
        for i in range(3):
            tbl.add(b'TestName', b'TestValue')

        assert tbl._current_size == 147
        tbl.maxsize = 146
        assert len(tbl.dynamic_entries) == 2
        assert tbl._current_size == 98
Exemplo n.º 7
0
 def test_shrink_maxsize_is_zero(self):
     tbl = HeaderTable()
     tbl.add(b'TestName', b'TestValue')
     assert len(tbl.dynamic_entries) == 1
     tbl.maxsize = 0
     assert len(tbl.dynamic_entries) == 0
Exemplo n.º 8
0
 def test_shrink_maxsize_is_zero(self):
     tbl = HeaderTable()
     tbl.add(b'TestName',b'TestValue')
     assert len(tbl.dynamic_entries) == 1
     tbl.maxsize = 0
     assert len(tbl.dynamic_entries) == 0