@@ -847,8 +847,8 @@ def get_summary_text(self, *options):
847
847
"""
848
848
self .make_rigged_file ("file1.py" , 339 , 155 )
849
849
self .make_rigged_file ("file2.py" , 13 , 3 )
850
- self .make_rigged_file ("file3 .py" , 234 , 228 )
851
- self .make_file ("doit.py" , "import file1, file2, file3 " )
850
+ self .make_rigged_file ("file10 .py" , 234 , 228 )
851
+ self .make_file ("doit.py" , "import file1, file2, file10 " )
852
852
853
853
cov = Coverage (source = ["." ], omit = ["doit.py" ])
854
854
cov .start ()
@@ -871,7 +871,7 @@ def test_test_data(self):
871
871
# ------------------------------
872
872
# file1.py 339 155 54%
873
873
# file2.py 13 3 77%
874
- # file3 .py 234 228 3%
874
+ # file10 .py 234 228 3%
875
875
# ------------------------------
876
876
# TOTAL 586 386 34%
877
877
@@ -906,30 +906,40 @@ def assert_ordering(self, text, *words):
906
906
msg = f"The words { words !r} don't appear in order in { text !r} "
907
907
assert indexes == sorted (indexes ), msg
908
908
909
+ def test_default_sort_report (self ):
910
+ # Sort the text report by the default (Name) column.
911
+ report = self .get_summary_text ()
912
+ self .assert_ordering (report , "file1.py" , "file2.py" , "file10.py" )
913
+
914
+ def test_sort_report_by_name (self ):
915
+ # Sort the text report explicitly by the Name column.
916
+ report = self .get_summary_text (('report:sort' , 'Name' ))
917
+ self .assert_ordering (report , "file1.py" , "file2.py" , "file10.py" )
918
+
909
919
def test_sort_report_by_stmts (self ):
910
920
# Sort the text report by the Stmts column.
911
921
report = self .get_summary_text (('report:sort' , 'Stmts' ))
912
- self .assert_ordering (report , "file2.py" , "file3 .py" , "file1.py" )
922
+ self .assert_ordering (report , "file2.py" , "file10 .py" , "file1.py" )
913
923
914
924
def test_sort_report_by_missing (self ):
915
925
# Sort the text report by the Missing column.
916
926
report = self .get_summary_text (('report:sort' , 'Miss' ))
917
- self .assert_ordering (report , "file2.py" , "file1.py" , "file3 .py" )
927
+ self .assert_ordering (report , "file2.py" , "file1.py" , "file10 .py" )
918
928
919
929
def test_sort_report_by_cover (self ):
920
930
# Sort the text report by the Cover column.
921
931
report = self .get_summary_text (('report:sort' , 'Cover' ))
922
- self .assert_ordering (report , "file3 .py" , "file1.py" , "file2.py" )
932
+ self .assert_ordering (report , "file10 .py" , "file1.py" , "file2.py" )
923
933
924
934
def test_sort_report_by_cover_plus (self ):
925
935
# Sort the text report by the Cover column, including the explicit + sign.
926
936
report = self .get_summary_text (('report:sort' , '+Cover' ))
927
- self .assert_ordering (report , "file3 .py" , "file1.py" , "file2.py" )
937
+ self .assert_ordering (report , "file10 .py" , "file1.py" , "file2.py" )
928
938
929
939
def test_sort_report_by_cover_reversed (self ):
930
940
# Sort the text report by the Cover column reversed.
931
941
report = self .get_summary_text (('report:sort' , '-Cover' ))
932
- self .assert_ordering (report , "file2.py" , "file1.py" , "file3 .py" )
942
+ self .assert_ordering (report , "file2.py" , "file1.py" , "file10 .py" )
933
943
934
944
def test_sort_report_by_invalid_option (self ):
935
945
# Sort the text report by a nonsense column.
0 commit comments