Exemple #1
0
    def test_guarantee_object_id_typeerror(self):
        """Test that `guarantee_object_id()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            guarantee_object_id(1)

        with self.assertRaises(TypeError):
            guarantee_object_id([AN_OBJECT_ID_STR])
Exemple #2
0
    def test_guarantee_object_id_typeerror(self):
        """Test that `guarantee_object_id()` raises `TypeError`."""

        with self.assertRaises(TypeError):
            guarantee_object_id(1)

        with self.assertRaises(TypeError):
            guarantee_object_id([AN_OBJECT_ID_STR])
Exemple #3
0
    def test_guarantee_object_id(self):
        """Test the `guarantee_object_id()` method."""

        expected = AN_OBJECT_ID
        actual = guarantee_object_id(AN_OBJECT_ID_STR)

        self.assertEqual(actual, expected)
Exemple #4
0
    def test_guarantee_object_id(self):
        """Test the `guarantee_object_id()` method."""

        expected = AN_OBJECT_ID
        actual = guarantee_object_id(AN_OBJECT_ID_STR)

        self.assertEqual(actual, expected)
Exemple #5
0
    def test_guarantee_object_id_tuple(self):
        """Test the `guarantee_object_id()` method with a `tuple`."""

        expected = {
            '$in': [AN_OBJECT_ID, AN_OBJECT_ID],
        }
        actual = guarantee_object_id({
            '$in': (AN_OBJECT_ID_STR, AN_OBJECT_ID),
        })
        self.assertEqual(actual, expected)
Exemple #6
0
    def test_guarantee_object_id_tuple(self):
        """Test the `guarantee_object_id()` method with a `tuple`."""

        expected = {
            '$in': [AN_OBJECT_ID, AN_OBJECT_ID],
        }
        actual = guarantee_object_id({
            '$in': (AN_OBJECT_ID_STR, AN_OBJECT_ID),
        })
        self.assertEqual(actual, expected)
Exemple #7
0
    def test_guarantee_object_id_dict(self):
        """Test the `guarantee_object_id()` method with `dict`."""

        expected = {
            '$gt': AN_OBJECT_ID,
            '$lt': AN_OBJECT_ID,
        }
        actual = guarantee_object_id({
            '$gt': AN_OBJECT_ID_STR,
            '$lt': AN_OBJECT_ID,
        })
        self.assertEqual(actual, expected)
Exemple #8
0
    def test_guarantee_object_id_dict(self):
        """Test the `guarantee_object_id()` method with `dict`."""

        expected = {
            '$gt': AN_OBJECT_ID,
            '$lt': AN_OBJECT_ID,
        }
        actual = guarantee_object_id({
            '$gt': AN_OBJECT_ID_STR,
            '$lt': AN_OBJECT_ID,
        })
        self.assertEqual(actual, expected)
Exemple #9
0
    def test_guarantee_object_id_invalidid(self):
        """Test that `guarantee_object_id()` raises `InvalidId`."""

        with self.assertRaises(InvalidId):
            guarantee_object_id('abc')
Exemple #10
0
    def test_guarantee_object_id_invalidid(self):
        """Test that `guarantee_object_id()` raises `InvalidId`."""

        with self.assertRaises(InvalidId):
            guarantee_object_id('abc')