def test_shogi_input_is_initable(self): shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", }]) self.assertEqual(shogi.channel_id, "channel_id") shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", }]) self.assertIsNone(shogi) ShogiInput.clear("channel_id") shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", }]) self.assertEqual(shogi.channel_id, "channel_id")
def test_shogi_input_is_initable(self): shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", } ]) self.assertEqual(shogi.channel_id, "channel_id") shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", } ]) self.assertIsNone(shogi) ShogiInput.clear("channel_id") shogi = ShogiInput.init("channel_id", [{ "id": "user1", "name": "user1name", }, { "id": "user2", "name": "user2name", } ]) self.assertEqual(shogi.channel_id, "channel_id")
def resign(channel, message): message.send("最終局面") board = ShogiInput.get_shogi_board(channel.channel_id) board_str = ShogiOutput.make_board_emoji(board) message.send(board_str) ShogiInput.clear(channel.channel_id)
def test_clear_for_non_exists_channnel(self): self.assertIsNone(ShogiInput.clear("channel_id_non_exists"))