def test_part_two(self): "Test part two example of Bingo object" # 1. Create Bingo object from text myobj = bingo.Bingo(part2=True, text=aoc_04.from_text(PART_TWO_TEXT)) # 2. Check the part two result self.assertEqual(myobj.part_two(verbose=False), PART_TWO_RESULT)
def test_part_one(self): "Test part one example of Bingo object" # 1. Create Bingo object from text myobj = bingo.Bingo(text=aoc_04.from_text(PART_ONE_TEXT)) # 2. Check the part one result self.assertEqual(myobj.part_one(verbose=False), PART_ONE_RESULT)
def test_text_init(self): "Test the Bingo object creation from text" # 1. Create Bingo object from text myobj = bingo.Bingo(text=aoc_04.from_text(EXAMPLE_TEXT)) # 2. Make sure it has the expected values self.assertEqual(myobj.part2, False) self.assertEqual(len(myobj.text), 16) self.assertEqual(len(myobj.numbers), 27) self.assertEqual(len(myobj.cards), 3)
def test_empty_init(self): "Test the default Bingo creation" # 1. Create default Bingo object myobj = bingo.Bingo() # 2. Make sure it has the default values self.assertEqual(myobj.part2, False) self.assertEqual(myobj.text, None) self.assertEqual(len(myobj.numbers), 0) self.assertEqual(len(myobj.cards), 0)
def part_two(args, input_lines): "Process part two of the puzzle" # 1. Create the puzzle solver solver = bingo.Bingo(part2=True, text=input_lines) # 2. Determine the solution for part two solution = solver.part_two(verbose=args.verbose, limit=args.limit) if solution is None: print("There is no solution") else: print("The solution for part two is %s" % (solution)) # 3. Return result return solution is not None
if user.bot: continue sorted = False for role in user.roles: if role.name in breakdown: breakdown[role.name] += 1 sorted = True if not sorted: breakdown["Unsorted"] += 1 string = "House Members\n" for i in breakdown: string += f"> {i}: {breakdown[i]}\n" await ctx.send(string) c = cards.Cards() b.add_cog(c) b.add_cog(ficwriter.FicWriter(c)) b.add_cog(episodes.Episodes()) b.add_cog(bingo.Bingo()) b.add_cog(randomfic.RandomFic()) b.add_cog(stories.Stories()) with open('secret') as s: token = s.read()[:-1] # Read the Discord bot token from a soup or secret file print("Card Bot is going live!") b.run(token) # Start the bot, finally!