コード例 #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
コード例 #2
0
ファイル: test_table.py プロジェクト: irvind/hpack
 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
コード例 #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
コード例 #4
0
ファイル: test_table.py プロジェクト: irvind/hpack
 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
コード例 #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
コード例 #6
0
ファイル: test_table.py プロジェクト: Coder206/servo
    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
コード例 #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
コード例 #8
0
ファイル: test_table.py プロジェクト: irvind/hpack
 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