From 2c468ae0d5a1e25998373abb72d87b1ee7693816 Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Wed, 17 Jun 2015 12:46:58 +0530 Subject: Fix reading of binary data in read() As per the current code, this is the behavior: >>> with v.fopen("/abc", 'r') as f: ... data = f.read(5) >>> print data >>> print data.value hello >>> It's incorrect to return a ctypes internal object back to the user. In Python 2.x, read() always returns a string. It's really upto the consumer to decode this string into whatever encoding it was written with. This patch reverts parts of this old change: Ia2bb47343880cbf7121fed9510e4cfa085fe23bd Change-Id: Ia1d3e5834be2b856776bd3cf8382a17ffd61d5df Signed-off-by: Prashanth Pai --- test/unit/gluster/test_gfapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/unit/gluster') diff --git a/test/unit/gluster/test_gfapi.py b/test/unit/gluster/test_gfapi.py index 1463f76..f850f0f 100644 --- a/test/unit/gluster/test_gfapi.py +++ b/test/unit/gluster/test_gfapi.py @@ -163,7 +163,7 @@ class TestFile(unittest.TestCase): with patch("gluster.gfapi.api.glfs_read", _mock_glfs_read): b = self.fd.read(5) - self.assertEqual(b.value, "hello") + self.assertEqual(b, "hello") def test_read_fail_exception(self): mock_glfs_read = Mock() -- cgit