def test_get_translated_data__no_provider(self): """ Verify the runtime behavior of get_translated_data() """ unit = Unit({}) unit._provider = None self.assertEqual(unit.get_translated_data('foo'), 'foo')
def test_get_translated_data__None_msgid(self): """ Verify the runtime behavior of get_translated_data() """ unit = Unit({}) with mock.patch.object(unit, "_provider"): self.assertEqual(unit.get_translated_data(None), None)
def test_get_translated_data__typical(self): """ Verify the runtime behavior of get_translated_data() """ unit = Unit({}) with mock.patch.object(unit, "_provider") as mock_provider: retval = unit.get_translated_data('foo') mock_provider.get_translated_data.assert_called_with("foo") self.assertEqual(retval, mock_provider.get_translated_data())