def test_row_ispblh(self): self.assertEqual(Row.pblh(0).is_pblh(), 1) self.assertEqual(Row.pblh(3).is_pblh(), 1) self.assertEqual(Row.pblh(6).is_pblh(), 1) self.assertEqual(Row.pblh(9).is_pblh(), 1) self.assertTrue(Row.rounds(0).is_pblh()) self.assertFalse(Row.rounds(1).is_pblh()) self.assertFalse(Row.rounds(2).is_pblh()) self.assertFalse(Row.rounds(3).is_pblh()) self.assertFalse(Row.rounds(6).is_pblh()) self.assertFalse(Row.rounds(9).is_pblh()) self.assertTrue(Row('135264').is_pblh()) self.assertTrue(Row('156342').is_pblh()) self.assertFalse(Row('165342').is_pblh()) self.assertTrue(Row('1246375').is_pblh()) self.assertTrue(Row('1267453').is_pblh()) self.assertFalse(Row('1267543').is_pblh()) r = Row.pblh(10) self.assertTrue((r * r * r).is_pblh())
def test_row_pblh(self): self.assertEqual(Row.pblh(0), Row()) self.assertEqual(Row.pblh(1), Row('1')) self.assertEqual(Row.pblh(2), Row('12')) self.assertEqual(Row.pblh(3), Row('132')) self.assertEqual(Row.pblh(5), Row('13524')) self.assertEqual(Row.pblh(6), Row('135264')) self.assertEqual(Row.pblh(3, 10), Row('123')) self.assertEqual(Row.pblh(3, 2), Row('123')) self.assertEqual(Row.pblh(3, 2), Row('123')) self.assertEqual(Row.pblh(6, 2), Row('124635')) self.assertEqual(Row.pblh(7, 2), Row('1246375')) self.assertEqual(Row.pblh(9, 5), Row('123457968'))