/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_lockable_files.py

Deprecate LockableFiles.put_utf8 and put_bytes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
            self.assertEqual(4, len(unicode_string))
59
59
            byte_string = unicode_string.encode('utf-8')
60
60
            self.assertEqual(6, len(byte_string))
61
 
            self.assertRaises(UnicodeEncodeError, self.lockable.put, 'foo',
62
 
                              StringIO(unicode_string))
63
 
            self.lockable.put('foo', StringIO(byte_string))
 
61
            self.assertRaises(UnicodeEncodeError,
 
62
                self.applyDeprecated,
 
63
                deprecated_in((1, 6, 0)),
 
64
                self.lockable.put, 'foo',
 
65
                StringIO(unicode_string))
 
66
            self.applyDeprecated(
 
67
                deprecated_in((1, 6, 0)),
 
68
                self.lockable.put,
 
69
                'foo', StringIO(byte_string))
64
70
            byte_stream = self.applyDeprecated(
65
71
                deprecated_in((1, 5, 0)),
66
72
                self.lockable.get,
94
100
                self.lockable.get,
95
101
                'bar')
96
102
            self.assertEqual(byte_string, byte_stream.read())
97
 
            self.lockable.put_bytes('raw', 'raw\xffbytes')
 
103
            self.applyDeprecated(
 
104
                deprecated_in((1, 6, 0)),
 
105
                self.lockable.put_bytes,
 
106
                'raw', 'raw\xffbytes')
98
107
            byte_stream = self.applyDeprecated(
99
108
                deprecated_in((1, 5, 0)),
100
109
                self.lockable.get,
106
115
    def test_locks(self):
107
116
        self.lockable.lock_read()
108
117
        try:
109
 
            self.assertRaises(ReadOnlyError, self.lockable.put, 'foo', 
 
118
            self.assertRaises(ReadOnlyError, self.lockable.put, 'foo',
110
119
                              StringIO('bar\u1234'))
111
120
        finally:
112
121
            self.lockable.unlock()