Skip to content
Snippets Groups Projects
Commit 7967e2f8 authored by jay's avatar jay
Browse files

Fixes failing tests with control network API change.

parent d0c819f3
No related branches found
No related tags found
No related merge requests found
......@@ -222,7 +222,8 @@ class IsisStore(object):
for attr, attrtype in self.measure_attrs:
if attr in g.columns:
setattr(measure_spec, attr, attrtype(m[attr]))
measure_spec.sample = m.x
measure_spec.line = m.y
measure_spec.type = 2
measure_iterable.append(measure_spec)
self.nmeasures += 1
......
......@@ -20,40 +20,42 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
cls.npts = 5
serial_times = {295: '1971-07-31T01:24:11.754',
296: '1971-07-31T01:24:36.970'}
cls.serials = ['APOLLO15/METRIC/{}'.format(i) for i in serial_times.values()]
columns = ['point_id', 'point_type', 'serialnumber', 'measure_type', 'x', 'y', 'node_id']
cls.serials = {i:'APOLLO15/METRIC/{}'.format(j) for i, j in enumerate(serial_times.values())}
columns = ['point_id', 'point_type', 'serialnumber', 'measure_type', 'x', 'y', 'image_index']
data = []
for i in range(cls.npts):
data.append((i, 2, cls.serials[0], 2, 0, 0, 0))
data.append((i, 2, cls.serials[1], 2, 0, 0, 1))
dfs = [pd.DataFrame(data, columns=columns)]
df = pd.DataFrame(data, columns=columns)
cls.creation_date = strftime("%Y-%m-%d %H:%M:%S", gmtime())
cls.modified_date = strftime("%Y-%m-%d %H:%M:%S", gmtime())
io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')
io_controlnetwork.to_isis('test.net', df, cls.serials, mode='wb', targetname='Moon')
cls.header_message_size = 78
cls.point_start_byte = 65614 # 66949
def test_create_buffer_header(self):
self.npts = 5
npts = 5
serial_times = {295: '1971-07-31T01:24:11.754',
296: '1971-07-31T01:24:36.970'}
self.serials = ['APOLLO15/METRIC/{}'.format(i) for i in serial_times.values()]
columns = ['point_id', 'point_type', 'serialnumber', 'measure_type', 'x', 'y', 'node_id']
serials = {i:'APOLLO15/METRIC/{}'.format(j) for i, j in enumerate(serial_times.values())}
columns = ['point_id', 'point_type', 'serialnumber', 'measure_type', 'x', 'y', 'image_index']
data = []
for i in range(self.npts):
data.append((i, 2, self.serials[0], 2, 0, 0, 0))
data.append((i, 2, self.serials[1], 2, 0, 0, 1))
data.append((i, 2, serials[0], 2, 0, 0, 0))
data.append((i, 2, serials[1], 2, 0, 0, 1))
dfs = [pd.DataFrame(data, columns=columns)]
df = pd.DataFrame(data, columns=columns)
self.creation_date = strftime("%Y-%m-%d %H:%M:%S", gmtime())
self.modified_date = strftime("%Y-%m-%d %H:%M:%S", gmtime())
io_controlnetwork.to_isis('test.net', dfs, mode='wb', targetname='Moon')
io_controlnetwork.to_isis('test.net', df, serials, mode='wb', targetname='Moon')
self.header_message_size = 78
self.point_start_byte = 65614 # 66949
......@@ -86,7 +88,7 @@ class TestWriteIsisControlNetwork(unittest.TestCase):
self.assertEqual(str(i), point_protocol.id)
self.assertEqual(2, point_protocol.type)
for m in point_protocol.measures:
self.assertTrue(m.serialnumber in self.serials)
self.assertTrue(m.serialnumber in self.serials.values())
self.assertEqual(2, m.type)
def test_create_pvl_header(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment