~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_rio.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009, 2010, 2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
but this depends on the transport.
23
23
"""
24
24
 
25
 
import cStringIO
26
 
import os
27
25
import re
28
 
import sys
29
26
from tempfile import TemporaryFile
30
27
 
31
28
from bzrlib import (
32
29
    rio,
33
30
    )
34
 
from bzrlib.tests import TestCaseInTempDir, TestCase
35
 
from bzrlib.rio import (RioWriter, Stanza, read_stanza, read_stanzas, rio_file,
36
 
                        RioReader)
 
31
from bzrlib.tests import TestCase
 
32
from bzrlib.rio import (
 
33
    RioReader,
 
34
    Stanza,
 
35
    read_stanza,
 
36
    read_stanzas,
 
37
    rio_file,
 
38
    )
37
39
 
38
40
 
39
41
class TestRio(TestCase):
188
190
        self.assertEqual(s, None)
189
191
        self.assertTrue(s is None)
190
192
 
 
193
    def test_read_nul_byte(self):
 
194
        """File consisting of a nul byte causes an error."""
 
195
        self.assertRaises(ValueError, read_stanza, ['\0'])
 
196
 
 
197
    def test_read_nul_bytes(self):
 
198
        """File consisting of many nul bytes causes an error."""
 
199
        self.assertRaises(ValueError, read_stanza, ['\0' * 100])
 
200
 
191
201
    def test_read_iter(self):
192
202
        """Read several stanzas from file"""
193
203
        tmpf = TemporaryFile()