mirror of
https://github.com/robmcmullen/atrcopy.git
synced 2025-02-10 12:30:35 +00:00
Fixed segment rawdata copy for non-indexed segments
This commit is contained in:
parent
bd4ff9569a
commit
bdf0b67075
@ -228,8 +228,8 @@ class SegmentData(object):
|
|||||||
s = self.style.np_data.copy()
|
s = self.style.np_data.copy()
|
||||||
copy = SegmentData(d, s, order=self.order)
|
copy = SegmentData(d, s, order=self.order)
|
||||||
else:
|
else:
|
||||||
d = self.data
|
d = self.data.copy()
|
||||||
s = self.style
|
s = self.style.copy()
|
||||||
start, end = self.byte_bounds_offset()
|
start, end = self.byte_bounds_offset()
|
||||||
copy = SegmentData(d[start:end], s[start:end])
|
copy = SegmentData(d[start:end], s[start:end])
|
||||||
return copy
|
return copy
|
||||||
|
@ -38,10 +38,17 @@ class TestSegment1(object):
|
|||||||
|
|
||||||
def test_copy(self):
|
def test_copy(self):
|
||||||
for s in self.segments:
|
for s in self.segments:
|
||||||
c = s.rawdata.copy()
|
d = s.rawdata
|
||||||
print c.data.shape, c.is_indexed
|
print "orig:", d.data.shape, d.is_indexed, d.data, id(d.data)
|
||||||
print c.data.np_data, s.data.np_data
|
c = d.copy()
|
||||||
assert np.all((c.data - s.data) == 0)
|
print "copy", c.data.shape, c.is_indexed, c.data, id(c.data)
|
||||||
|
assert c.data.shape == s.data.shape
|
||||||
|
assert id(c) != id(s)
|
||||||
|
assert np.all((c.data[:] - s.data[:]) == 0)
|
||||||
|
c.data[0:100] = 1
|
||||||
|
print d.data
|
||||||
|
print c.data
|
||||||
|
assert not np.all((c.data[:] - s.data[:]) == 0)
|
||||||
|
|
||||||
|
|
||||||
class TestIndexed(object):
|
class TestIndexed(object):
|
||||||
@ -180,7 +187,7 @@ if __name__ == "__main__":
|
|||||||
t.test_indexed()
|
t.test_indexed()
|
||||||
t.test_indexed_sub()
|
t.test_indexed_sub()
|
||||||
t.test_interleave()
|
t.test_interleave()
|
||||||
#t = TestSegment1()
|
t = TestSegment1()
|
||||||
#t.setup()
|
t.setup()
|
||||||
#t.test_xex()
|
t.test_xex()
|
||||||
t.test_copy()
|
t.test_copy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user