def test_number_of_rows_for_deficient_3_by_3_square(self): r = DeficientRectangle(3, 3, 4, [(0, 0)]) rows = r.row_list() # 6 positions to place a t-tetromino # 4 monominos in each of the eight squares # 1 'magic monomino' in the (0,0) square self.assertEqual(len(rows), 6 + 4 * 8 + 1)
def test_some_output_for_strip(self): h = 14 w = 13 spare = 0 missing = [ (0, 0), (0, 1), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (3, 0), (3, 1), (3, 2), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0), (9, 0), (11, 0), (13, 0), (0, w - 1) ] r = DeficientRectangle(w, h, spare, missing) self.assertIsNotNone(r.header_text())
import sys from link_data import DeficientRectangle from shapes import w, h, spare, missing if __name__ == '__main__': r = DeficientRectangle(w, h, spare, missing) with open("names.txt", "w") as f: write(f, r.names_text()) with open("rows.txt", "w") as f: write(f, r.rows_text())
def test_the_number_of_rows_and_names_is_the_same(self): r = DeficientRectangle(3, 3, 4, [(0, 0)]) rows = r.row_list() names = list(r.names()) self.assertEqual(len(names), len(rows[0]))