File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -601,12 +601,17 @@ def filename(self):
601601 assert zim != Sub2 (fpath1 )
602602
603603
604- @skip_if_offline
605604def test_reader_get_random_entry (all_zims ):
606- fpath1 = Archive (all_zims / "zimfile.zim" )
607- fpath2 = Archive (all_zims / "example.zim" )
605+ zim_1 = Archive (all_zims / "zimfile.zim" )
608606
609- assert isinstance (fpath1 .get_random_entry (), Entry )
607+ entry_1 = zim_1 .get_random_entry ()
608+ entry_2 = zim_1 .get_random_entry ()
609+ assert isinstance (entry_1 , Entry )
610+ assert isinstance (entry_2 , Entry )
611+ # this may occasionaly fail (1 chance over 129)
612+ assert entry_1 != entry_2
610613
614+ # example.zim has no FRONT_ARTICLE (article_count=0): random cannot yield any result
615+ zim_2 = Archive (all_zims / "example.zim" )
611616 with pytest .raises (KeyError ):
612- fpath2 .get_random_entry ()
617+ zim_2 .get_random_entry ()
You can’t perform that action at this time.
0 commit comments