コード例 #1
0
ファイル: test_geo.py プロジェクト: dirn/Simon
    def test_circle(self):
        """Test the `circle()` method."""

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

        expected = {'$within': {'$circle': [[1, 2], 3]}}
        actual = geo.circle([1, 2], 3)
        self.assertEqual(actual, expected)
コード例 #2
0
    def test_circle(self):
        """Test the `circle()` method."""

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

        expected = {'$within': {'$circle': [[1, 2], 3]}}
        actual = geo.circle([1, 2], 3)
        self.assertEqual(actual, expected)
コード例 #3
0
ファイル: test_geo.py プロジェクト: dirn/Simon
    def test_circle_valueerror(self):
        """Test that `circle()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.circle([1, 2, 3], 4)
コード例 #4
0
ファイル: test_geo.py プロジェクト: dirn/Simon
    def test_circle_typeerror(self):
        """Test that `circle()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.circle(1, 2)
コード例 #5
0
    def test_circle_valueerror(self):
        """Test that `circle()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.circle([1, 2, 3], 4)
コード例 #6
0
    def test_circle_typeerror(self):
        """Test that `circle()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.circle(1, 2)