@@ -764,6 +764,7 @@ def test_invalid_license_files(self, license_files):
764
764
with pytest .raises (metadata .InvalidMetadata ):
765
765
meta .license_files # noqa: B018
766
766
767
+
767
768
class TestMetadataWriting :
768
769
def test_write_metadata (self ):
769
770
meta = metadata .Metadata .from_raw (_RAW_EXAMPLE )
@@ -855,42 +856,6 @@ def test_large(self):
855
856
}
856
857
)
857
858
858
- assert meta .as_json () == {
859
- "author" : "Example!" ,
860
- "author_email" :
"Unknown <[email protected] >" ,
861
- "classifier" : [
862
- "Development Status :: 4 - Beta" ,
863
- "Programming Language :: Python" ,
864
- ],
865
- "description" : "some readme 👋\n " ,
866
- "description_content_type" : "text/markdown" ,
867
- "keywords" : ["trampolim" , "is" , "interesting" ],
868
- "license" : "some license text" ,
869
- "maintainer_email" :
"Other Example <[email protected] >" ,
870
- "metadata_version" : "2.1" ,
871
- "name" : "full_metadata" ,
872
- "project_url" : [
873
- "homepage, example.com" ,
874
- "documentation, readthedocs.org" ,
875
- "repository, github.com/some/repo" ,
876
- "changelog, github.com/some/repo/blob/master/CHANGELOG.rst" ,
877
- ],
878
- "provides_extra" : ["test" ],
879
- "requires_dist" : [
880
- "dependency1" ,
881
- "dependency2>1.0.0" ,
882
- "dependency3[extra]" ,
883
- 'dependency4; os_name != "nt"' ,
884
- 'dependency5[other-extra]>1.0; os_name == "nt"' ,
885
- 'test_dependency; extra == "test"' ,
886
- 'test_dependency[test_extra]; extra == "test"' ,
887
- 'test_dependency[test_extra2]>3.0; os_name == "nt" and extra == "test"' ,
888
- ],
889
- "requires_python" : ">=3.8" ,
890
- "summary" : "A package with all the metadata :)" ,
891
- "version" : "3.2.1" ,
892
- }
893
-
894
859
core_metadata = meta .as_rfc822 ()
895
860
assert core_metadata .items () == [
896
861
("metadata-version" , "2.1" ),
@@ -928,3 +893,26 @@ def test_large(self):
928
893
]
929
894
930
895
assert core_metadata .get_payload () == "some readme 👋\n "
896
+
897
+ def test_modern_license (self ):
898
+ meta = metadata .Metadata .from_raw (
899
+ {
900
+ "metadata_version" : "2.4" ,
901
+ "name" : "full_metadata" ,
902
+ "version" : "3.2.1" ,
903
+ "license_expression" : "MIT" ,
904
+ "license_files" : ["LICENSE.txt" , "LICENSE" ],
905
+ }
906
+ )
907
+
908
+ core_metadata = meta .as_rfc822 ()
909
+ assert core_metadata .items () == [
910
+ ("metadata-version" , "2.4" ),
911
+ ("name" , "full_metadata" ),
912
+ ("version" , "3.2.1" ),
913
+ ("license-expression" , "MIT" ),
914
+ ("license-file" , "LICENSE.txt" ),
915
+ ("license-file" , "LICENSE" ),
916
+ ]
917
+
918
+ assert core_metadata .get_payload () is None
0 commit comments