from unittest import TestCase

from codenames.guessers.learned_guesser import LearnedGuesser
from codenames.embedding_handler import EmbeddingHandler
from codenames.guessers.policy.similarity_threshold import SimilarityThresholdPolicy


class TestLearnedGuesser(TestCase):
    def test_guess(self):
        embedding_handler = EmbeddingHandler("tests/fixtures/sample_embedding.txt")
        sample_board = ["boy", "girl", "woman", "man"]
        embed_size = list(embedding_handler.embedding.values())[0].shape[0]
        policy = SimilarityThresholdPolicy(embed_size)
        guesser = LearnedGuesser(sample_board, embedding_handler, policy, 0.1)
        sample_state = [0, -1, -1, -1]
        guesses = guesser.guess("boy", 1, sample_state, 0)
        guesser.report_reward([10])
        assert guesses == ['girl']

8219973e0208f6cca8d326396f99b142a94fff56
<mask token>

<mask token>


class TestLearnedGuesser(TestCase):
    <mask token>

<mask token>


class TestLearnedGuesser(TestCase):

    def test_guess(self):
        embedding_handler = EmbeddingHandler(
            'tests/fixtures/sample_embedding.txt')
        sample_board = ['boy', 'girl', 'woman', 'man']
        embed_size = list(embedding_handler.embedding.values())[0].shape[0]
        policy = SimilarityThresholdPolicy(embed_size)
        guesser = LearnedGuesser(sample_board, embedding_handler, policy, 0.1)
        sample_state = [0, -1, -1, -1]
        guesses = guesser.guess('boy', 1, sample_state, 0)
        guesser.report_reward([10])
        assert guesses == ['girl']

from unittest import TestCase
from codenames.guessers.learned_guesser import LearnedGuesser
from codenames.embedding_handler import EmbeddingHandler
from codenames.guessers.policy.similarity_threshold import SimilarityThresholdPolicy


class TestLearnedGuesser(TestCase):

    def test_guess(self):
        embedding_handler = EmbeddingHandler(
            'tests/fixtures/sample_embedding.txt')
        sample_board = ['boy', 'girl', 'woman', 'man']
        embed_size = list(embedding_handler.embedding.values())[0].shape[0]
        policy = SimilarityThresholdPolicy(embed_size)
        guesser = LearnedGuesser(sample_board, embedding_handler, policy, 0.1)
        sample_state = [0, -1, -1, -1]
        guesses = guesser.guess('boy', 1, sample_state, 0)
        guesser.report_reward([10])
        assert guesses == ['girl']

from unittest import TestCase

from codenames.guessers.learned_guesser import LearnedGuesser
from codenames.embedding_handler import EmbeddingHandler
from codenames.guessers.policy.similarity_threshold import SimilarityThresholdPolicy


class TestLearnedGuesser(TestCase):
    def test_guess(self):
        embedding_handler = EmbeddingHandler("tests/fixtures/sample_embedding.txt")
        sample_board = ["boy", "girl", "woman", "man"]
        embed_size = list(embedding_handler.embedding.values())[0].shape[0]
        policy = SimilarityThresholdPolicy(embed_size)
        guesser = LearnedGuesser(sample_board, embedding_handler, policy, 0.1)
        sample_state = [0, -1, -1, -1]
        guesses = guesser.guess("boy", 1, sample_state, 0)
        guesser.report_reward([10])
        assert guesses == ['girl']
