def test_print_01(self): ssd_0 = SevenSegmentsDisplay(1, [(' ', '-', ' '), ('|', ' ', '|'), (' ', ' ', ' '), ('|', ' ', '|'), (' ', '-', ' ')]) ssd_1 = SevenSegmentsDisplay(1, [(' ', ' ', ' '), (' ', ' ', '|'), (' ', ' ', ' '), (' ', ' ', '|'), (' ', ' ', ' ')]) printer = SevenSegmentsPrinter([ssd_0, ssd_1]) printer.show() self.assertEquals(sys.stdout.getvalue(), ' - \n' + '| | |\n' + ' \n' + '| | |\n' + ' - \n')
def test_one(self): self.ssd = SevenSegmentsDisplay(1, [(' ', ' ', ' '), (' ', ' ', '|'), (' ', ' ', ' '), (' ', ' ', '|'), (' ', ' ', ' ')]) self.assertEqual(' ', self.ssd.topLeft()) self.assertEqual(' ', self.ssd.topCenter()) self.assertEqual(' ', self.ssd.topRight()) self.assertEqual(' ', self.ssd.midTopLeft()) self.assertEqual(' ', self.ssd.midTopCenter()) self.assertEqual('|', self.ssd.midTopRight()) self.assertEqual(' ', self.ssd.midLeft()) self.assertEqual(' ', self.ssd.midCenter()) self.assertEqual(' ', self.ssd.midRight()) self.assertEqual(' ', self.ssd.midBottonLeft()) self.assertEqual(' ', self.ssd.midBottonCenter()) self.assertEqual('|', self.ssd.midBottonRight()) self.assertEqual(' ', self.ssd.bottonLeft()) self.assertEqual(' ', self.ssd.bottonCenter()) self.assertEqual(' ', self.ssd.bottonRight())
def setUp(self): self.ssdOff = SevenSegmentsDisplay(1, [(' ', ' ', ' '), (' ', ' ', ' '), (' ', ' ', ' '), (' ', ' ', ' '), (' ', ' ', ' ')]) self.held, sys.stdout = sys.stdout, StringIO()
def setUp(self): self.ssd = SevenSegmentsDisplay(1, [(' ', '-', ' '), ('|', ' ', '|'), (' ', '-', ' '), ('|', ' ', '|'), (' ', '-', ' ')])