예제 #1
0
 def test_file_three_complete_items_content_one(self) -> None:
     global FILE_CONTENT_THREE_COMPLETE_ITEMS
     with _MockFile(FILE_CONTENT_THREE_COMPLETE_ITEMS) as mock:
         any_obj = pip_licenses_reader.read_file(mock)
         project: pip_licenses_reader.ProjectInfo = (
             FileContentTest.sort_items(any_obj.projects)[0]
         )
         self.assertEqual(project.author, "Somebody")
         self.assertEqual(str(project.version), "1.2.3")
         self.assertEqual(project.url, "https://any.site")
         self.assertEqual(project.license, "MIT")
         self.assertEqual(project.name, "AnyPackage")
예제 #2
0
 def test_file_three_complete_items_content_three(self) -> None:
     global FILE_CONTENT_THREE_COMPLETE_ITEMS
     with _MockFile(FILE_CONTENT_THREE_COMPLETE_ITEMS) as mock:
         any_obj = pip_licenses_reader.read_file(mock)
         project: pip_licenses_reader.ProjectInfo = (
             FileContentTest.sort_items(any_obj.projects)[2]
         )
         self.assertEqual(project.author, "Carsten Igel")
         self.assertEqual(str(project.version), "0.8.0")
         self.assertEqual(
             project.url,
             "https://github.com/carstencodes/pip-licenses-reader",
         )
         self.assertEqual(project.license, "BSD")
         self.assertEqual(project.name, "pip_licenses_reader")
예제 #3
0
 def test_file_is_object_empty_frozenset(self) -> None:
     global FILE_CONTENT_IS_OBJ
     with _MockFile(FILE_CONTENT_IS_OBJ) as mock:
         any_obj = pip_licenses_reader.read_file(mock)
         self.assertEqual(len(any_obj.projects), 0)
예제 #4
0
 def test_file_is_object(self) -> None:
     global FILE_CONTENT_IS_OBJ
     with _MockFile(FILE_CONTENT_IS_OBJ) as mock:
         any_obj = pip_licenses_reader.read_file(mock)
         self.assertIsNotNone(any_obj)
예제 #5
0
 def test_no_file_returns_empty_frozen_set(self) -> None:
     any_obj = pip_licenses_reader.read_file()
     self.assertEqual(len(any_obj.projects), 0)
예제 #6
0
 def test_no_file_returns_empty(self) -> None:
     any_obj = pip_licenses_reader.read_file()
     self.assertIsNotNone(any_obj)
예제 #7
0
 def test_default_typing_collection_type(self) -> None:
     any_obj = pip_licenses_reader.read_file()
     self.assertTrue(isinstance(any_obj.projects, frozenset))
예제 #8
0
 def test_default_typing_major_type(self) -> None:
     any_obj = pip_licenses_reader.read_file()
     self.assertTrue(
         isinstance(any_obj, pip_licenses_reader.LicenseCollection)
     )
예제 #9
0
 def test_file_three_complete_items_success(self) -> None:
     global FILE_CONTENT_THREE_COMPLETE_ITEMS
     with _MockFile(FILE_CONTENT_THREE_COMPLETE_ITEMS) as mock:
         any_obj = pip_licenses_reader.read_file(mock)
         self.assertIsNotNone(any_obj)
         self.assertEqual(len(any_obj.projects), 3)