def test_15menu_entry7_no_comment(self): """Check entry with no comment is handled correctly""" menu_options = gcv.read_menu_options("testdata/15-commits") menu_text = gcv.print_menu_subsection(menu_options, 5, 9) # Check no blank line in between the options expected = self.ENTRY_7 + self.ENTRY_8 self.assertTrue(expected in menu_text)
def test_4menu_show_0_to_4(self): """Check 4 options are shown correctly with Q, but no P or N""" menu_options = gcv.read_menu_options("testdata/4-commits") menu_text = gcv.print_menu_subsection(menu_options, 0, 4) self.assertTrue( self.ENTRY_0 + self.ENTRY_1 + self.ENTRY_2 + self.ENTRY_3 + self.QUIT in menu_text) self.assertFalse(self.PREVIOUS in menu_text) self.assertFalse(self.ENTRY_4 in menu_text) self.assertFalse(self.NEXT in menu_text)
def test_15menu_show_5_to_9(self): """Check middle 5 options shown correctly with P, N and Q""" menu_options = gcv.read_menu_options("testdata/15-commits") menu_text = gcv.print_menu_subsection(menu_options, 5, 9) self.assertTrue( self.PREVIOUS + self.ENTRY_5 + self.ENTRY_6 + self.ENTRY_7 + self.ENTRY_8 + self.ENTRY_9 + self.NEXT + self.QUIT in menu_text) self.assertFalse(self.ENTRY_4 in menu_text) self.assertFalse(self.ENTRY_10 in menu_text)
def test_8menu_show_5_to_9(self): """Check last 3 options shown correctly with P and Q. Checks suppression of N when fewer than 5 options.""" menu_options = gcv.read_menu_options("testdata/8-commits") menu_text = gcv.print_menu_subsection(menu_options, 5, 9) self.assertTrue( self.PREVIOUS + self.ENTRY_5 + self.ENTRY_6 + self.ENTRY_7 + self.QUIT in menu_text) self.assertFalse(self.ENTRY_4 in menu_text) self.assertFalse(self.ENTRY_8 in menu_text) self.assertFalse(self.NEXT in menu_text)
def test_15menu_show_10_to_14(self): """Check last 5 options shown correctly with P and Q. This tests suppression of N with a full 5 options in last set""" menu_options = gcv.read_menu_options("testdata/15-commits") menu_text = gcv.print_menu_subsection(menu_options, 10, 14) self.assertTrue( self.PREVIOUS + self.ENTRY_10 + self.ENTRY_11 + self.ENTRY_12 + self.ENTRY_13 + self.ENTRY_14 + self.QUIT in menu_text) self.assertFalse(self.ENTRY_9 in menu_text) self.assertFalse(self.NEXT in menu_text)
def test_15menu_num_options(self): """Check 15-option menu parsing returns correct number of options""" menu_options = gcv.read_menu_options("testdata/15-commits") self.assertEqual(len(menu_options), 15)