Пример #1
0
 def test_empty_parts(self):
     parts = [None, {'part_index': 'a', 'calc_state': 'b'}, None]
     results = PropagationResults(parts)
     self.assertEqual(3, len(results.get_parts()))
     self.assertIsNone(results.get_parts()[0])
     self.assertIsNotNone(results.get_parts()[1])
     self.assertIsNone(results.get_parts()[2])
Пример #2
0
    def test_get_methods(self):
        # All keys.
        pr = PropagationResults([{
            'part_index': 'a',
            'calc_state': 'b',
            'stk_ephemeris': 'c',
            'error': 'd'
        }])
        self.assertEqual(1, len(pr.get_parts()))
        p = pr.get_parts()[0]
        self.assertEqual('a', p.get_part_index())
        self.assertEqual('b', p.get_calc_state())
        self.assertEqual('c', p.get_ephemeris())
        self.assertEqual('d', p.get_error())

        # Only required keys.
        pr = PropagationResults([{
            'part_index': 'a',
            'calc_state': 'b',
        }])
        self.assertEqual(1, len(pr.get_parts()))
        p = pr.get_parts()[0]
        self.assertEqual('a', p.get_part_index())
        self.assertEqual('b', p.get_calc_state())
        self.assertIsNone(p.get_ephemeris())
        self.assertIsNone(p.get_error())