Beispiel #1
0
 def test_command_random_unique(self):
     xkcd.seen_comics = list(range(1, 1000))
     xkcd.cur_max_comic = 1000
     xkcd.seen_comics.remove(404)
     xkcd.sel_comic = 1
     xkcd.command_random()
     self.assertEqual(xkcd.sel_comic, 1000)
Beispiel #2
0
 def test_command_random_fast(self):
     random.seed(666)
     xkcd.cur_max_comic = 1000
     xkcd.sel_comic = 1
     randint = random.randint(1, xkcd.cur_max_comic)
     random.seed(666)
     xkcd.command_random("-f")
     self.assertEqual(xkcd.sel_comic, randint)
Beispiel #3
0
 def test_command_random_display(self):
     random_seed = 1514
     expected_output = comic_1_transcript
     xkcd.use_less = False
     random.seed(random_seed)
     xkcd.cur_max_comic = 1000
     xkcd.sel_comic = 1
     output = xkcd.command_random("-f", "-d")
     self.assertEqual(output, expected_output)