def test_liberty_feature(self): f = features.liberty_feature(TEST_POSITION) self.assertEqual(f.shape, (9, 9, features.liberty_feature.planes)) self.assertEqual(f[0, 0, 0], 0) # the stone at 0, 1 has 3 liberties. self.assertEqual(f[0, 1, 2], 1) self.assertEqual(f[0, 1, 4], 0) # the group at 0, 7 has 3 liberties self.assertEqual(f[0, 7, 2], 1) self.assertEqual(f[0, 8, 2], 1) # the group at 1, 0 has 18 liberties self.assertEqual(f[1, 0, 7], 1)