コード例 #1
0
ファイル: test_geo.py プロジェクト: dirn/Simon
    def test_near_valueerror(self):
        """Test that `near()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.near([1])

        with self.assertRaises(ValueError):
            geo.near([1, 2, 3])
コード例 #2
0
    def test_near_valueerror(self):
        """Test that `near()` raises `ValueError`."""

        with self.assertRaises(ValueError):
            geo.near([1])

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

        expected = {'$near': [1, 2]}
        actual = geo.near([1, 2])
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$maxDistance': 3}
        actual = geo.near([1, 2], max_distance=3)
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$uniqueDocs': True}
        actual = geo.near([1, 2], unique_docs=True)
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$maxDistance': 3, '$uniqueDocs': True}
        actual = geo.near([1, 2], max_distance=3, unique_docs=True)
        self.assertEqual(actual, expected)

        # near() supports point as a tuple
        expected = {'$near': (1, 2)}
        actual = geo.near((1, 2))
        self.assertEqual(actual, expected)
コード例 #4
0
    def test_near(self):
        """Test the `near()` method."""

        expected = {'$near': [1, 2]}
        actual = geo.near([1, 2])
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$maxDistance': 3}
        actual = geo.near([1, 2], max_distance=3)
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$uniqueDocs': True}
        actual = geo.near([1, 2], unique_docs=True)
        self.assertEqual(actual, expected)

        expected = {'$near': [1, 2], '$maxDistance': 3, '$uniqueDocs': True}
        actual = geo.near([1, 2], max_distance=3, unique_docs=True)
        self.assertEqual(actual, expected)

        # near() supports point as a tuple
        expected = {'$near': (1, 2)}
        actual = geo.near((1, 2))
        self.assertEqual(actual, expected)
コード例 #5
0
ファイル: test_geo.py プロジェクト: dirn/Simon
    def test_near_typeerror(self):
        """Test that `near()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.near(1)
コード例 #6
0
    def test_near_typeerror(self):
        """Test that `near()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            geo.near(1)