MCPcopy Create free account
hub / github.com/ml-explore/mlx-data / test_replace

Method test_replace

python/tests/test_replace.py:9–20  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

7
8class TestReplace(unittest.TestCase):
9 def test_replace(self):
10 s = "Hello world".encode()
11 dset = dx.buffer_from_vector([dict(text=s)])
12
13 ds = dset.replace("text", "world", "everybody!")
14 self.assertEqual(bytes(ds[0]["text"]), b"Hello everybody!")
15
16 ds = dset.replace("text", "l", "b")
17 self.assertEqual(bytes(ds[0]["text"]), b"Hebbo worbd")
18
19 ds = dset.replace("text", "l", "b", 2)
20 self.assertEqual(bytes(ds[0]["text"]), b"Hebbo world")
21
22
23if __name__ == "__main__":

Callers

nothing calls this directly

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected