Test parsing valid package index JSON
(self)
| 138 | """Test PackageIndexParser functionality""" |
| 139 | |
| 140 | def test_parse_valid_json(self) -> None: |
| 141 | """Test parsing valid package index JSON""" |
| 142 | valid_json: dict[str, Any] = { |
| 143 | "packages": [ |
| 144 | { |
| 145 | "name": "test", |
| 146 | "maintainer": "Test Maintainer", |
| 147 | "websiteURL": "https://example.com", |
| 148 | "email": "test@example.com", |
| 149 | "help": {"online": "https://example.com"}, |
| 150 | "platforms": [], |
| 151 | "tools": [], |
| 152 | } |
| 153 | ] |
| 154 | } |
| 155 | |
| 156 | parser = PackageIndexParser() |
| 157 | package_index = parser.parse_package_index(json.dumps(valid_json)) |
| 158 | assert len(package_index.packages) == 1 |
| 159 | assert package_index.packages[0].name == "test" |
| 160 | |
| 161 | def test_parse_invalid_json(self) -> None: |
| 162 | """Test parsing invalid JSON""" |
nothing calls this directly
no test coverage detected