/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack.py

  • Committer: Andrew Bennetts
  • Date: 2007-10-29 08:34:38 UTC
  • mto: (2535.4.22 streaming-smart-fetch)
  • mto: This revision was merged to the branch mainline in revision 2981.
  • Revision ID: andrew.bennetts@canonical.com-20071029083438-ke1vsv97dvgrvup5
ImproveĀ someĀ docstrings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
191
191
 
192
192
 
193
193
class TestContainerReader(tests.TestCase):
 
194
    """Tests for the ContainerReader.
 
195
 
 
196
    The ContainerReader reads format 1 containers, so these tests explicitly
 
197
    test how it reacts to format 1 data.  If a new version of the format is
 
198
    added, then separate tests for that format should be added.
 
199
    """
194
200
 
195
201
    def get_reader_for(self, bytes):
196
202
        stream = StringIO(bytes)
323
329
        
324
330
 
325
331
class TestBytesRecordReader(tests.TestCase):
326
 
    """Tests for reading and validating Bytes records with BytesRecordReader."""
 
332
    """Tests for reading and validating Bytes records with
 
333
    BytesRecordReader.
 
334
    
 
335
    Like TestContainerReader, this explicitly tests the reading of format 1
 
336
    data.  If a new version of the format is added, then a separate set of
 
337
    tests for reading that format should be added.
 
338
    """
327
339
 
328
340
    def get_reader_for(self, bytes):
329
341
        stream = StringIO(bytes)
550
562
 
551
563
 
552
564
class PushParserTestCase(tests.TestCase):
 
565
    """Base class for TestCases involving ContainerPushParser."""
553
566
 
554
567
    def make_parser_expecting_record_type(self):
555
568
        parser = pack.ContainerPushParser()
562
575
        return parser
563
576
 
564
577
    def assertRecordParsing(self, expected_record, bytes):
 
578
        """Assert that 'bytes' is parsed as a given bytes record.
 
579
 
 
580
        :param expected_record: A tuple of (names, bytes).
 
581
        """
565
582
        parser = self.make_parser_expecting_bytes_record()
566
583
        parser.accept_bytes(bytes)
567
584
        parsed_records = parser.read_pending_records()
569
586
 
570
587
        
571
588
class TestContainerPushParser(PushParserTestCase):
572
 
    """Tests for ContainerPushParser."""
 
589
    """Tests for ContainerPushParser.
 
590
    
 
591
    The ContainerPushParser reads format 1 containers, so these tests
 
592
    explicitly test how it reacts to format 1 data.  If a new version of the
 
593
    format is added, then separate tests for that format should be added.
 
594
    """
573
595
 
574
596
    def test_construct(self):
575
597
        """ContainerPushParser can be constructed."""
589
611
 
590
612
 
591
613
class TestContainerPushParserBytesParsing(PushParserTestCase):
592
 
    """Tests for reading Bytes records with ContainerPushParser."""
 
614
    """Tests for reading Bytes records with ContainerPushParser.
 
615
    
 
616
    The ContainerPushParser reads format 1 containers, so these tests
 
617
    explicitly test how it reacts to format 1 data.  If a new version of the
 
618
    format is added, then separate tests for that format should be added.
 
619
    """
593
620
 
594
621
    def test_record_with_no_name(self):
595
622
        """Reading a Bytes record with no name returns an empty list of