~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_chunk_writer.py

  • Committer: John Arbash Meinel
  • Date: 2008-10-15 21:34:10 UTC
  • mto: This revision was merged to the branch mainline in revision 3791.
  • Revision ID: john@arbash-meinel.com-20081015213410-g19sy2rpgxcl2sew
Change the name to ChunkWriter.set_optimize()

Also allow it to be passed during __init__ and pass it in from
BTreeBuilder.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
    def test_optimize_for_speed(self):
43
43
        writer = chunk_writer.ChunkWriter(4096)
44
 
        writer.optimize(for_size=False)
 
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)
45
48
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_speed,
46
49
                         (writer._max_repack, writer._max_zsync))
47
50
 
48
51
    def test_optimize_for_size(self):
49
52
        writer = chunk_writer.ChunkWriter(4096)
50
 
        writer.optimize(for_size=True)
 
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)
51
57
        self.assertEqual(chunk_writer.ChunkWriter._repack_opts_for_size,
52
58
                         (writer._max_repack, writer._max_zsync))
53
59