-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Henry Schreiner <[email protected]>
- Loading branch information
Showing
2 changed files
with
25 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -764,6 +764,7 @@ def test_invalid_license_files(self, license_files): | |
with pytest.raises(metadata.InvalidMetadata): | ||
meta.license_files # noqa: B018 | ||
|
||
|
||
class TestMetadataWriting: | ||
def test_write_metadata(self): | ||
meta = metadata.Metadata.from_raw(_RAW_EXAMPLE) | ||
|
@@ -855,42 +856,6 @@ def test_large(self): | |
} | ||
) | ||
|
||
assert meta.as_json() == { | ||
"author": "Example!", | ||
"author_email": "Unknown <[email protected]>", | ||
"classifier": [ | ||
"Development Status :: 4 - Beta", | ||
"Programming Language :: Python", | ||
], | ||
"description": "some readme 👋\n", | ||
"description_content_type": "text/markdown", | ||
"keywords": ["trampolim", "is", "interesting"], | ||
"license": "some license text", | ||
"maintainer_email": "Other Example <[email protected]>", | ||
"metadata_version": "2.1", | ||
"name": "full_metadata", | ||
"project_url": [ | ||
"homepage, example.com", | ||
"documentation, readthedocs.org", | ||
"repository, github.com/some/repo", | ||
"changelog, github.com/some/repo/blob/master/CHANGELOG.rst", | ||
], | ||
"provides_extra": ["test"], | ||
"requires_dist": [ | ||
"dependency1", | ||
"dependency2>1.0.0", | ||
"dependency3[extra]", | ||
'dependency4; os_name != "nt"', | ||
'dependency5[other-extra]>1.0; os_name == "nt"', | ||
'test_dependency; extra == "test"', | ||
'test_dependency[test_extra]; extra == "test"', | ||
'test_dependency[test_extra2]>3.0; os_name == "nt" and extra == "test"', | ||
], | ||
"requires_python": ">=3.8", | ||
"summary": "A package with all the metadata :)", | ||
"version": "3.2.1", | ||
} | ||
|
||
core_metadata = meta.as_rfc822() | ||
assert core_metadata.items() == [ | ||
("metadata-version", "2.1"), | ||
|
@@ -928,3 +893,26 @@ def test_large(self): | |
] | ||
|
||
assert core_metadata.get_payload() == "some readme 👋\n" | ||
|
||
def test_modern_license(self): | ||
meta = metadata.Metadata.from_raw( | ||
{ | ||
"metadata_version": "2.4", | ||
"name": "full_metadata", | ||
"version": "3.2.1", | ||
"license_expression": "MIT", | ||
"license_files": ["LICENSE.txt", "LICENSE"], | ||
} | ||
) | ||
|
||
core_metadata = meta.as_rfc822() | ||
assert core_metadata.items() == [ | ||
("metadata-version", "2.4"), | ||
("name", "full_metadata"), | ||
("version", "3.2.1"), | ||
("license-expression", "MIT"), | ||
("license-file", "LICENSE.txt"), | ||
("license-file", "LICENSE"), | ||
] | ||
|
||
assert core_metadata.get_payload() is None |