Exemplo n.º 1
0
    def test_callback_invoked(self):
        amounts_seen = []

        def callback(amount):
            amounts_seen.append(amount)

        original_stream = six.StringIO('foobarbaz')
        wrapped = StreamReaderProgress(original_stream, callback)
        self.assertEqual(wrapped.read(), 'foobarbaz')
        self.assertEqual(amounts_seen, [9])
Exemplo n.º 2
0
    def test_callback_invoked(self):
        amounts_seen = []

        def callback(amount):
            amounts_seen.append(amount)

        original_stream = six.StringIO('foobarbaz')
        wrapped = StreamReaderProgress(original_stream, callback)
        self.assertEqual(wrapped.read(), 'foobarbaz')
        self.assertEqual(amounts_seen, [9])
Exemplo n.º 3
0
 def test_proxies_to_wrapped_stream(self):
     original_stream = six.StringIO('foobarbaz')
     wrapped = StreamReaderProgress(original_stream)
     self.assertEqual(wrapped.read(), 'foobarbaz')
Exemplo n.º 4
0
 def test_proxies_to_wrapped_stream(self):
     original_stream = six.StringIO('foobarbaz')
     wrapped = StreamReaderProgress(original_stream)
     self.assertEqual(wrapped.read(), 'foobarbaz')