Skip to content

Commit

Permalink
fix/valid langs list
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Oct 23, 2023
1 parent ffc9683 commit 1c9b038
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions test/unittests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,6 @@ def test_utterance_state(self):
self.assertIsInstance(state, UtteranceState)
self.assertIsInstance(state, str)

@patch("ovos_bus_client.session.get_default_lang")
@patch("ovos_bus_client.session.Configuration")
def test_get_valid_langs(self, config, default_lang):
config.return_value = {
"secondary_langs": ["en-us", "es-mx", "fr-ca"]
}
default_lang.return_value = "en-us"
from ovos_bus_client.session import _get_valid_langs
# Test default in secondary
langs = _get_valid_langs()
self.assertIsInstance(langs, list)
self.assertEqual(len(langs), len(set(langs)))
self.assertEqual(set(langs), {"en-us", "es-mx", "fr-ca"})

# Test default not in secondary
default_lang.return_value = "pt-pt"
langs = _get_valid_langs()
self.assertIsInstance(langs, list)
self.assertEqual(len(langs), len(set(langs)))
self.assertEqual(set(langs), {"en-us", "es-mx", "fr-ca", "pt-pt"})

# Test no secondary
config.return_value = {}
langs = _get_valid_langs()
self.assertEqual(langs, [default_lang.return_value])

# Test invalid secondary lang config
config.return_value = {"secondary_langs": None}
with self.assertRaises(TypeError):
_get_valid_langs()


class TestIntentContextManagerFrame(unittest.TestCase):
def test_serialize_deserialize(self):
Expand Down Expand Up @@ -138,7 +107,6 @@ def test_init(self):
session = Session()
self.assertIsInstance(session.session_id, str)
self.assertIsInstance(session.lang, str)
self.assertIsInstance(session.valid_languages, list)
self.assertEqual(session.active_skills, list())
self.assertEqual(session.utterance_states, dict())
self.assertIsInstance(session.touch_time, int)
Expand Down Expand Up @@ -216,7 +184,6 @@ def test_serialize_deserialize(self):
self.assertIsInstance(test_session, Session)
self.assertIsInstance(test_session.session_id, str)
self.assertIsInstance(test_session.lang, str)
self.assertIsInstance(test_session.valid_languages, list)
self.assertIsInstance(test_session.active_skills, list)
self.assertIsInstance(test_session.utterance_states, dict)
self.assertIsInstance(test_session.touch_time, int)
Expand Down

0 comments on commit 1c9b038

Please sign in to comment.