Exemplo n.º 1
0
    def test_box_valueerror(self):
        """Test that `box()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.box([1, 2, 3], [4, 5])

        with self.assertRaises(ValueError):
            geo.box([1, 2], [3, 4, 5])
Exemplo n.º 2
0
    def test_box_typeerror(self):
        """Test that `box()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.box(1, [2, 3])

        with self.assertRaises(TypeError):
            geo.box([1, 2], 3)
Exemplo n.º 3
0
    def test_box_valueerror(self):
        """Test that `box()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.box([1, 2, 3], [4, 5])

        with self.assertRaises(ValueError):
            geo.box([1, 2], [3, 4, 5])
Exemplo n.º 4
0
    def test_box_typeerror(self):
        """Test that `box()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.box(1, [2, 3])

        with self.assertRaises(TypeError):
            geo.box([1, 2], 3)
Exemplo n.º 5
0
    def test_box(self):
        """Test the `box()` method."""

        with mock.patch('simon.geo.within') as within:
            geo.box([1, 2], [3, 4])
            within.assert_called_with('box', [1, 2], [3, 4])

        expected = {'$within': {'$box': [[1, 2], [3, 4]]}}
        actual = geo.box([1, 2], [3, 4])
        self.assertEqual(actual, expected)
Exemplo n.º 6
0
    def test_box(self):
        """Test the `box()` method."""

        with mock.patch('simon.geo.within') as within:
            geo.box([1, 2], [3, 4])
            within.assert_called_with('box', [1, 2], [3, 4])

        expected = {'$within': {'$box': [[1, 2], [3, 4]]}}
        actual = geo.box([1, 2], [3, 4])
        self.assertEqual(actual, expected)