예제 #1
0
파일: test_geo.py 프로젝트: dirn/Simon
    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])
예제 #2
0
파일: test_geo.py 프로젝트: dirn/Simon
    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)
예제 #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])
예제 #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)
예제 #5
0
파일: test_geo.py 프로젝트: dirn/Simon
    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)
예제 #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)