Пример #1
0
 def test_exception_thrown_if_requested_state_alias_not_provided(self):
     trans = EnvrStateAliasTranslator()
     trans.state_aliases = {0: "state1", 1: "state2", 2: "state3"}
     with self.assertRaises(ValueError) as cm:
         trans.state_alias(3)
     self.assertEqual(
         str(cm.exception), "No alias specified for state " "with code '3'."
     )
Пример #2
0
 def test_can_add_state_aliases(self):
     trans = EnvrStateAliasTranslator()
     trans.state_aliases = {0: "state1", 1: "state2", 2: "state3"}
     self.assertEqual(trans.state_alias(0), "state1")
     self.assertEqual(trans.state_alias(1), "state2")
     self.assertEqual(trans.state_alias(2), "state3")