def test_color_choice_for_unassigned(self): """Test color choice for unassigned items.""" class_under_test = card_generator.Generator() card_color, line_style = class_under_test.get_first_line_style( class_under_test.UNASSIGNED) self.assertEqual(card_color, class_under_test.ROYAL_BLUE) self.assertEqual(line_style, class_under_test.FIRST_LINE_UNASSIGNED)
def test_colors(self): """Test that all ten supported colors are there.""" class_under_test = card_generator.Generator() class_under_test.load_colors() actual_colors = class_under_test.colors self.assertEqual(len(actual_colors), 10)
def main(): """Start card generation.""" file_path, output_path = get_file_paths() xml_tree = elementTree.parse(file_path) entries = get_entries_from_xml(xml_tree) creator = card_generator.Generator() creator.create_pdf(entries, output_path) open_output_file(output_path)
def test_rank_style_choice(self): """Test correct rank style choice for old rank format.""" class_under_test = card_generator.Generator() short_rank = "774" assignee = "Meyer, Max" first_line_style = "A first line style" rank_style = class_under_test.get_rank_style(short_rank, assignee, first_line_style) self.assertEqual(rank_style, first_line_style) # repeat with unassigned task, should not matter with a short rank rank_style = class_under_test.get_rank_style( short_rank, class_under_test.UNASSIGNED, first_line_style) self.assertEqual(rank_style, first_line_style)
def test_rank_style_choice_with_lexo_rank(self): """Test correct rank style choice for new lexo rank format.""" class_under_test = card_generator.Generator() assignee = "Meyer, Max" lexo_rank = "0|hzzzz7:" first_line_style = "firstLine" rank_style = class_under_test.get_rank_style(lexo_rank, assignee, first_line_style) self.assertEqual(rank_style, class_under_test.LARGE_RANK_STYLE) # repeat with unassigned task rank_style = class_under_test.get_rank_style( lexo_rank, class_under_test.UNASSIGNED, first_line_style) self.assertEqual(rank_style, class_under_test.LARGE_RANK_STYLE_UNASSIGNED)
def test_get_color(self): """Test color choice for assigned items.""" class_under_test = card_generator.Generator() assignee = "Meyer, Max" # set color to hot pink hot_pink = (255 / 256, 110 / 256, 180 / 256) gold = (255 / 256, 236 / 256, 139 / 256) class_under_test.colors = [hot_pink] chosen_color = class_under_test.get_card_color(assignee) self.assertEqual(chosen_color, hot_pink) # re-set colors class_under_test.colors = [gold] chosen_color = class_under_test.get_card_color(assignee) self.assertEqual(chosen_color, hot_pink)