Example #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])
Example #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)
Example #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])
Example #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)
Example #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)
Example #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)