make sure that bytearray methods return a new bytearray even if there is no change

Fixes #4348
Reviewed by Brett
diff --git a/Lib/test/test_bytes.py b/Lib/test/test_bytes.py
index a583a48..6e5ffa9 100644
--- a/Lib/test/test_bytes.py
+++ b/Lib/test/test_bytes.py
@@ -721,6 +721,16 @@
         b.insert(0, Indexable(ord('A')))
         self.assertEqual(b, b'A')
 
+    def test_copied(self):
+        # Issue 4348.  Make sure that operations that don't mutate the array
+        # copy the bytes.
+        b = bytearray(b'abc')
+        #self.assertFalse(b is b.replace(b'abc', b'cde', 0))
+
+        t = bytearray([i for i in range(256)])
+        x = bytearray(b'')
+        self.assertFalse(x is x.translate(t))
+
     def test_partition_bytearray_doesnt_share_nullstring(self):
         a, b, c = bytearray(b"x").partition(b"y")
         self.assertEqual(b, b"")