diff --git a/tests/unit/v1/test_async_collection.py b/tests/unit/v1/test_async_collection.py index 680b0eb85..e40a3d92d 100644 --- a/tests/unit/v1/test_async_collection.py +++ b/tests/unit/v1/test_async_collection.py @@ -79,20 +79,6 @@ def test_constructor(self): expected_path = (collection_id1, document_id, collection_id2) self.assertEqual(collection._path, expected_path) - def test_constructor_invalid_path(self): - with self.assertRaises(ValueError): - self._make_one() - with self.assertRaises(ValueError): - self._make_one(99, "doc", "bad-collection-id") - with self.assertRaises(ValueError): - self._make_one("bad-document-ID", None, "sub-collection") - with self.assertRaises(ValueError): - self._make_one("Just", "A-Document") - - def test_constructor_invalid_kwarg(self): - with self.assertRaises(TypeError): - self._make_one("Coh-lek-shun", donut=True) - @pytest.mark.asyncio async def test_add_auto_assigned(self): from google.cloud.firestore_v1.types import document diff --git a/tests/unit/v1/test_async_document.py b/tests/unit/v1/test_async_document.py index b59c7282b..71e3ce4a8 100644 --- a/tests/unit/v1/test_async_document.py +++ b/tests/unit/v1/test_async_document.py @@ -47,20 +47,6 @@ def test_constructor(self): ) self.assertEqual(document.path, expected_path) - def test_constructor_invalid_path(self): - with self.assertRaises(ValueError): - self._make_one() - with self.assertRaises(ValueError): - self._make_one(None, "before", "bad-collection-id", "fifteen") - with self.assertRaises(ValueError): - self._make_one("bad-document-ID", None) - with self.assertRaises(ValueError): - self._make_one("Just", "A-Collection", "Sub") - - def test_constructor_invalid_kwarg(self): - with self.assertRaises(TypeError): - self._make_one("Coh-lek-shun", "Dahk-yu-mehnt", burger=18.75) - @staticmethod def _make_commit_repsonse(write_results=None): from google.cloud.firestore_v1.types import firestore diff --git a/tests/unit/v1/test_async_query.py b/tests/unit/v1/test_async_query.py index 87305bfbc..f8b8fdaae 100644 --- a/tests/unit/v1/test_async_query.py +++ b/tests/unit/v1/test_async_query.py @@ -32,7 +32,7 @@ def _make_one(self, *args, **kwargs): klass = self._get_target_class() return klass(*args, **kwargs) - def test_constructor_defaults(self): + def test_constructor(self): query = self._make_one(mock.sentinel.parent) self.assertIs(query._parent, mock.sentinel.parent) self.assertIsNone(query._projection) diff --git a/tests/unit/v1/test_base_collection.py b/tests/unit/v1/test_base_collection.py index cbdbc2898..870f95019 100644 --- a/tests/unit/v1/test_base_collection.py +++ b/tests/unit/v1/test_base_collection.py @@ -41,13 +41,19 @@ def test_constructor(self): expected_path = (collection_id1, document_id, collection_id2) self.assertEqual(collection._path, expected_path) - def test_constructor_invalid_path(self): + def test_constructor_invalid_path_empty(self): with self.assertRaises(ValueError): self._make_one() + + def test_constructor_invalid_path_bad_collection_id(self): with self.assertRaises(ValueError): self._make_one(99, "doc", "bad-collection-id") + + def test_constructor_invalid_path_bad_document_id(self): with self.assertRaises(ValueError): self._make_one("bad-document-ID", None, "sub-collection") + + def test_constructor_invalid_path_bad_number_args(self): with self.assertRaises(ValueError): self._make_one("Just", "A-Document") diff --git a/tests/unit/v1/test_base_document.py b/tests/unit/v1/test_base_document.py index c478ff9a6..0f4556cf9 100644 --- a/tests/unit/v1/test_base_document.py +++ b/tests/unit/v1/test_base_document.py @@ -47,13 +47,19 @@ def test_constructor(self): ) self.assertEqual(document.path, expected_path) - def test_constructor_invalid_path(self): + def test_constructor_invalid_path_empty(self): with self.assertRaises(ValueError): self._make_one() + + def test_constructor_invalid_path_bad_collection_id(self): with self.assertRaises(ValueError): self._make_one(None, "before", "bad-collection-id", "fifteen") + + def test_constructor_invalid_path_bad_document_id(self): with self.assertRaises(ValueError): self._make_one("bad-document-ID", None) + + def test_constructor_invalid_path_bad_number_args(self): with self.assertRaises(ValueError): self._make_one("Just", "A-Collection", "Sub") diff --git a/tests/unit/v1/test_collection.py b/tests/unit/v1/test_collection.py index 51bce74c2..3833033f4 100644 --- a/tests/unit/v1/test_collection.py +++ b/tests/unit/v1/test_collection.py @@ -68,20 +68,6 @@ def test_constructor(self): expected_path = (collection_id1, document_id, collection_id2) self.assertEqual(collection._path, expected_path) - def test_constructor_invalid_path(self): - with self.assertRaises(ValueError): - self._make_one() - with self.assertRaises(ValueError): - self._make_one(99, "doc", "bad-collection-id") - with self.assertRaises(ValueError): - self._make_one("bad-document-ID", None, "sub-collection") - with self.assertRaises(ValueError): - self._make_one("Just", "A-Document") - - def test_constructor_invalid_kwarg(self): - with self.assertRaises(TypeError): - self._make_one("Coh-lek-shun", donut=True) - def test_add_auto_assigned(self): from google.cloud.firestore_v1.types import document from google.cloud.firestore_v1.document import DocumentReference diff --git a/tests/unit/v1/test_document.py b/tests/unit/v1/test_document.py index 920cb91f1..ff06532c4 100644 --- a/tests/unit/v1/test_document.py +++ b/tests/unit/v1/test_document.py @@ -46,20 +46,6 @@ def test_constructor(self): ) self.assertEqual(document.path, expected_path) - def test_constructor_invalid_path(self): - with self.assertRaises(ValueError): - self._make_one() - with self.assertRaises(ValueError): - self._make_one(None, "before", "bad-collection-id", "fifteen") - with self.assertRaises(ValueError): - self._make_one("bad-document-ID", None) - with self.assertRaises(ValueError): - self._make_one("Just", "A-Collection", "Sub") - - def test_constructor_invalid_kwarg(self): - with self.assertRaises(TypeError): - self._make_one("Coh-lek-shun", "Dahk-yu-mehnt", burger=18.75) - @staticmethod def _make_commit_repsonse(write_results=None): from google.cloud.firestore_v1.types import firestore diff --git a/tests/unit/v1/test_query.py b/tests/unit/v1/test_query.py index 1f4759acb..53ed463c3 100644 --- a/tests/unit/v1/test_query.py +++ b/tests/unit/v1/test_query.py @@ -31,7 +31,7 @@ def _make_one(self, *args, **kwargs): klass = self._get_target_class() return klass(*args, **kwargs) - def test_constructor_defaults(self): + def test_constructor(self): query = self._make_one(mock.sentinel.parent) self.assertIs(query._parent, mock.sentinel.parent) self.assertIsNone(query._projection)