Exemplo n.º 1
0
	def test_pair_from_array_raises_exception_if_argument_is_not_a_2d_array(self):  # noqa
		with self.assertRaises(GeometryException) as error_context:
			Pair.from_array(numpy.array([2, 3, 5]))
		self.assertEqual(
			error_context.exception.message,
			"Can only be created from a 2d array",
			)
Exemplo n.º 2
0
	def test_pair_chain_strings_pairs_together_into_a_single_tuple(self):
		p1 = Pair(2, 3)
		p2 = Pair(4, 5)
		p3 = Pair(6, 7)
		self.assertEqual(Pair.chain(p1, p2, p3), (2, 3, 4, 5, 6, 7))
Exemplo n.º 3
0
	def test_pair_from_array_creates_an_instance_from_a_2d_numpy_array(self):
		p = Pair.from_array(numpy.array([2, 3]))
		self.assertIsInstance(p, Pair)
		self.assertEqual(p.a[0], 2)
		self.assertEqual(p.a[1], 3)