Add type ignore comments to suppress type checking warnings in test assertions
All checks were successful
/ unit-tests (push) Successful in 9s
All checks were successful
/ unit-tests (push) Successful in 9s
This commit is contained in:
23
tests.py
23
tests.py
@@ -19,17 +19,17 @@ class Test01(unittest.TestCase):
|
||||
"""Getting a specific project by ID (object instantiation)"""
|
||||
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
self.assertEqual(project.name, "ADO Sandbox")
|
||||
self.assertEqual(project.name, "ADO Sandbox") # type: ignore[attr-defined]
|
||||
def test_03(self):
|
||||
"""Getting a specific project by name using org indexing (object retrieval)"""
|
||||
project = self.org["ADO Sandbox"]
|
||||
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
self.assertEqual(project.name, "ADO Sandbox")
|
||||
self.assertEqual(project.name, "ADO Sandbox") # type: ignore[attr-defined]
|
||||
def test_04(self):
|
||||
"""Getting a specific project by ID using org indexing (object retrieval)"""
|
||||
project = self.org["bafe0cf1-6c97-4088-864a-ea6dc02b2727"]
|
||||
self.assertEqual(project.id, "bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
self.assertEqual(project.name, "ADO Sandbox")
|
||||
self.assertEqual(project.name, "ADO Sandbox") # type: ignore[attr-defined]
|
||||
|
||||
class Test02(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -45,21 +45,21 @@ class Test02(unittest.TestCase):
|
||||
"""Getting a specific repository by ID (object instantiation)"""
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
self.assertEqual(repo.id, "feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
self.assertEqual(repo.name, "ado-auth-lab")
|
||||
self.assertEqual(repo.name, "ado-auth-lab") # type: ignore[attr-defined]
|
||||
|
||||
def test_03(self):
|
||||
"""Getting a specific repository by name using project indexing (object retrieval)"""
|
||||
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
repo = project["ado-auth-lab"]
|
||||
self.assertEqual(repo.id, "feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
self.assertEqual(repo.name, "ado-auth-lab")
|
||||
self.assertEqual(repo.name, "ado-auth-lab") # type: ignore[attr-defined]
|
||||
|
||||
def test_04(self):
|
||||
"""Getting a specific repository by ID using project indexing (object retrieval)"""
|
||||
project = Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727")
|
||||
repo = project["feac266f-84d2-41bc-839b-736925a85eaa"]
|
||||
self.assertEqual(repo.id, "feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
self.assertEqual(repo.name, "ado-auth-lab")
|
||||
self.assertEqual(repo.name, "ado-auth-lab") # type: ignore[attr-defined]
|
||||
|
||||
class Test03(unittest.TestCase):
|
||||
def setUp(self):
|
||||
@@ -69,7 +69,7 @@ class Test03(unittest.TestCase):
|
||||
"""Getting details of a specific item in a repository"""
|
||||
item = Item(Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa"), path="/generate-pat.py")
|
||||
self.assertEqual(item.path, "/generate-pat.py")
|
||||
self.assertIsNotNone(item.commit_id)
|
||||
self.assertIsNotNone(item.commit_id) # type: ignore[attr-defined]
|
||||
|
||||
def test_02(self):
|
||||
"""Listing items in a folder within a repository"""
|
||||
@@ -83,14 +83,14 @@ class Test03(unittest.TestCase):
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
item = repo["/container"]
|
||||
self.assertEqual(item.path, "/container")
|
||||
self.assertTrue(item.is_folder)
|
||||
self.assertTrue(item.is_folder) # type: ignore[attr-defined]
|
||||
|
||||
def test_04(self):
|
||||
"""Getting a specific item from a repository using indexing"""
|
||||
repo = Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa")
|
||||
item = repo["/generate-pat.py"]
|
||||
self.assertEqual(item.path, "/generate-pat.py")
|
||||
self.assertFalse(item.is_folder)
|
||||
self.assertFalse(item.is_folder) # type: ignore[attr-defined]
|
||||
|
||||
def test_05(self):
|
||||
"""Attempting to get a non-existent item from a repository using indexing"""
|
||||
@@ -106,7 +106,7 @@ class Test04(unittest.TestCase):
|
||||
"""Getting details of a specific item in a repository"""
|
||||
item = Item(Repository(Project(self.org, id="bafe0cf1-6c97-4088-864a-ea6dc02b2727"), id="feac266f-84d2-41bc-839b-736925a85eaa"), path="/generate-pat.py")
|
||||
self.assertEqual(item.path, "/generate-pat.py")
|
||||
self.assertIsNotNone(item.commit_id)
|
||||
self.assertIsNotNone(item.commit_id) # type: ignore[attr-defined]
|
||||
|
||||
def test_02(self):
|
||||
"""Trying to instantiate Item for a item that does not exist"""
|
||||
@@ -114,7 +114,8 @@ class Test04(unittest.TestCase):
|
||||
with self.assertRaises(requests.exceptions.HTTPError):
|
||||
item = Item(repo, path="/non-existent-file.txt")
|
||||
self.assertEqual(item.path, "/non-existent-file.txt")
|
||||
commit_id = item.commit_id # This will raise HTTPError when trying to fetch details of a non-existent item
|
||||
# This will raise HTTPError when trying to fetch details of a non-existent item
|
||||
commit_id = item.commit_id # type: ignore[attr-defined]
|
||||
|
||||
def test_03(self):
|
||||
"""Listing items in a folder within a repository"""
|
||||
|
||||
Reference in New Issue
Block a user