Esempio n. 1
0
 def test_translation(self):
     # print microsoft_translate(u'English', 'en', 'es')
     # print type(microsoft_translate(u'Español', 'es', 'en'))
     # assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     # assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'English', 'en', 'es') == 'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == 'Spanish'
Esempio n. 2
0
#
#
# # get all users in reverse alphabetical order
# print models.User.query.order_by('nickname desc').all()

# from app.models import Post
# from app import db
# for post in Post.query.all():
#    db.session.delete(post)
# db.session.commit()

# from flask.ext.mail import Message
# from app import app, mail
# from config import ADMINS
# msg = Message('test subject', sender=ADMINS[0], recipients=ADMINS)
# msg.body = 'text body'
# msg.html = '<b>HTML</b> body'
#
#
# def send_async_email(msg):
#     with app.app_context():
#         print msg
#         mail.send(msg)
#
# thr = Thread(target=send_async_email(msg), args=app.app_context())
#

from app import translate

print translate.microsoft_translate('Hi, how are you?', 'en', 'he')
Esempio n. 3
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'Ingls'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
Esempio n. 4
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'\ufeff"Ingl\xe9s"'
     assert microsoft_translate(u'Español', 'es', 'en') == u'\ufeff"Spanish"'
Esempio n. 5
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
Esempio n. 6
0
	def test_translation(self):

		assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
Esempio n. 7
0
def translate():
    return jsonify({
        'text':
        microsoft_translate(request.form['text'], request.form['sourceLang'],
                            request.form['destLang'])
    })
Esempio n. 8
0
 def test_translation(self):
     assert unicode(microsoft_translate('English', 'en', 'ru'),
                    "unicode-escape") == 'Английский'
     assert microsoft_translate('Español', 'es', 'en') == 'Spanish'
Esempio n. 9
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'zh') == u'英语'
     assert microsoft_translate(u'中文', 'zh', 'en') == u'Chinese'
Esempio n. 10
0
#
#
# # get all users in reverse alphabetical order
# print models.User.query.order_by('nickname desc').all()

# from app.models import Post
# from app import db
# for post in Post.query.all():
#    db.session.delete(post)
# db.session.commit()


# from flask.ext.mail import Message
# from app import app, mail
# from config import ADMINS
# msg = Message('test subject', sender=ADMINS[0], recipients=ADMINS)
# msg.body = 'text body'
# msg.html = '<b>HTML</b> body'
#
#
# def send_async_email(msg):
#     with app.app_context():
#         print msg
#         mail.send(msg)
#
# thr = Thread(target=send_async_email(msg), args=app.app_context())
#

from app import translate
print translate.microsoft_translate('Hi, how are you?', 'en', 'he')
Esempio n. 11
0
 def test_translation(self):
     # This fails but does not give an error
     assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'Deutsch', 'de', 'en') == u'German'
     assert microsoft_translate(u'English', 'en', 'de') == u'Englisch'
Esempio n. 12
0
def translate():
    return jsonify({
        'text': microsoft_translate(
            request.form['text'],
            request.form['sourceLang'],
            request.form['destLang']) })
Esempio n. 13
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en',
                                'es') == u'\ufeff"Ingl\xe9s"'
     assert microsoft_translate(u'Español', 'es',
                                'en') == u'\ufeff"Spanish"'
Esempio n. 14
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'fr') == u'Anglais'
     assert microsoft_translate(u'Français', 'fr', 'en') == u'French'
Esempio n. 15
0
File: tests.py Progetto: ghjan/blog
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'zh') == u'英语'
     assert microsoft_translate(u'中文', 'zh', 'en') == u'Chinese'
Esempio n. 16
0
 def test_translation(self):
     assert microsoft_translate(u'Hi, how are you today?', 'en', 'es') == u'Hola, \xbfc\xf3mo est\xe1s hoy?'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'