Ejemplo n.º 1
0
 def test_parse_points_should_codify_altitudes_using_points(self):
     points = EarthMatrix._parse_points([
         [5, 4, 3],
         [1, 2, 6],
         [7, 9, 0],
     ])
     self.assertEqual(3, len(points))
     self.assertEqual(3, len(points[0]))
     self.assertEqual(3, len(points[1]))
     self.assertEqual(3, len(points[2]))
     self.assertEqual(EarthPoint(0, 0, 5), points[0][0])
     self.assertEqual(EarthPoint(0, 1, 4), points[0][1])
     self.assertEqual(EarthPoint(0, 2, 3), points[0][2])
     self.assertEqual(EarthPoint(1, 0, 1), points[1][0])
     self.assertEqual(EarthPoint(1, 1, 2), points[1][1])
     self.assertEqual(EarthPoint(1, 2, 6), points[1][2])
     self.assertEqual(EarthPoint(2, 0, 7), points[2][0])
     self.assertEqual(EarthPoint(2, 1, 9), points[2][1])
     self.assertEqual(EarthPoint(2, 2, 0), points[2][2])
Ejemplo n.º 2
0
 def test_parse_points_should_raise_if_validation_raises(
         self, mock_validate):
     with self.assertRaises(EarthMatrixException) as context:
         EarthMatrix._parse_points([[]])
     self.assertEqual('Something wrong happened', context.exception.message)
Ejemplo n.º 3
0
 def test_parse_points_should_return_empty_matrix_if_points_are_empty(self):
     points = EarthMatrix._parse_points([[]])
     self.assertEqual(1, len(points))
     self.assertEqual(0, len(points[0]))