def test_multiple_reads(self): f = _LengthLimitedFile(StringIO('foobar'), 3) self.assertEquals('fo', f.read(2)) self.assertEquals('o', f.read(2)) self.assertEquals('', f.read())
def test_multiple_reads(self): f = _LengthLimitedFile(BytesIO(b'foobar'), 3) self.assertEqual(b'fo', f.read(2)) self.assertEqual(b'o', f.read(2)) self.assertEqual(b'', f.read())
def test_cutoff(self): f = _LengthLimitedFile(StringIO('foobar'), 3) self.assertEquals('foo', f.read()) self.assertEquals('', f.read())
def test_no_cutoff(self): f = _LengthLimitedFile(StringIO('foobar'), 1024) self.assertEqual('foobar', f.read())
def test_cutoff(self): f = _LengthLimitedFile(BytesIO(b'foobar'), 3) self.assertEqual(b'foo', f.read()) self.assertEqual(b'', f.read())
def test_multiple_reads(self): f = _LengthLimitedFile(BytesIO(b"foobar"), 3) self.assertEqual(b"fo", f.read(2)) self.assertEqual(b"o", f.read(2)) self.assertEqual(b"", f.read())
def test_cutoff(self): f = _LengthLimitedFile(BytesIO(b"foobar"), 3) self.assertEqual(b"foo", f.read()) self.assertEqual(b"", f.read())
def test_multiple_reads(self): f = _LengthLimitedFile(StringIO("foobar"), 3) self.assertEquals("fo", f.read(2)) self.assertEquals("o", f.read(2)) self.assertEquals("", f.read())
def test_cutoff(self): f = _LengthLimitedFile(StringIO("foobar"), 3) self.assertEquals("foo", f.read()) self.assertEquals("", f.read())