~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chunk_writer.py

  • Committer: Vincent Ladeuil
  • Date: 2008-09-11 19:36:38 UTC
  • mfrom: (3703 +trunk)
  • mto: (3705.1.1 trunk2)
  • mto: This revision was merged to the branch mainline in revision 3708.
  • Revision ID: v.ladeuil+lp@free.fr-20080911193638-wtjyc1kcmacc6t1f
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
#
17
17
 
18
18
"""Tests for writing fixed size chunks with compression."""
39
39
        # Only a zlib header.
40
40
        self.assertEqual(4088, padding)
41
41
 
42
 
    def test_optimize_for_speed(self):
43
 
        writer = chunk_writer.ChunkWriter(4096)
44
 
        writer.set_optimize(for_size=False)
45
 
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_speed,
46
 
                         (writer._max_repack, writer._max_zsync))
47
 
        writer = chunk_writer.ChunkWriter(4096, optimize_for_size=False)
48
 
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_speed,
49
 
                         (writer._max_repack, writer._max_zsync))
50
 
 
51
 
    def test_optimize_for_size(self):
52
 
        writer = chunk_writer.ChunkWriter(4096)
53
 
        writer.set_optimize(for_size=True)
54
 
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_size,
55
 
                         (writer._max_repack, writer._max_zsync))
56
 
        writer = chunk_writer.ChunkWriter(4096, optimize_for_size=True)
57
 
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_size,
58
 
                         (writer._max_repack, writer._max_zsync))
59
 
 
60
42
    def test_some_data(self):
61
43
        writer = chunk_writer.ChunkWriter(4096)
62
44
        writer.write("foo bar baz quux\n")