403Webshell
Server IP : 217.160.0.64  /  Your IP : 216.73.216.137
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : ws67269618 ( 67269618)
PHP Version : 8.4.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /kunden/kunden/usr/lib/python3/dist-packages/breezy/bzr/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /kunden/kunden/usr/lib/python3/dist-packages/breezy/bzr/tests/test_tuned_gzip.py
# Copyright (C) 2006, 2009, 2010, 2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA


"""Tests for tuned_gzip."""

import gzip
from io import BytesIO

from .. import tests, tuned_gzip


class TestToGzip(tests.TestCase):
    def assertToGzip(self, chunks):
        raw_bytes = b"".join(chunks)
        gzfromchunks = tuned_gzip.chunks_to_gzip(chunks)
        decoded = gzip.GzipFile(fileobj=BytesIO(b"".join(gzfromchunks))).read()
        lraw, ldecoded = len(raw_bytes), len(decoded)
        self.assertEqual(
            lraw, ldecoded, f"Expecting data length {lraw}, got {ldecoded}"
        )
        self.assertEqual(raw_bytes, decoded)

    def test_single_chunk(self):
        self.assertToGzip([b"a modest chunk\nwith some various\nbits\n"])

    def test_simple_text(self):
        self.assertToGzip([b"some\n", b"strings\n", b"to\n", b"process\n"])

    def test_large_chunks(self):
        self.assertToGzip([b"a large string\n" * 1024])
        self.assertToGzip([b"a large string\n"] * 1024)

    def test_enormous_chunks(self):
        self.assertToGzip([b"a large string\n" * 1024 * 256])
        self.assertToGzip([b"a large string\n"] * 1024 * 256)

Youez - 2016 - github.com/yon3zu
LinuXploit