Skip to content

Commit

Permalink
Basic pytest wiring
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerin Philip committed Feb 15, 2022
1 parent c0f95e2 commit 46a160b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions bindings/python/test_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest

from bergamot import REPOSITORY
from bergamot import ResponseOptions, Service, ServiceConfig, VectorString


def test_basic():
keys = ['browsermt']
config = ServiceConfig(numWorkers=1, logLevel='critical')
service = Service(config)
for repository in keys:
models = REPOSITORY.models(repository, filter_downloaded=False)
for model in models:
REPOSITORY.download(repository, model)

for modelId in models:
configPath = REPOSITORY.modelConfigPath(repository, modelId)
model = service.modelFromConfigPath(configPath)
options = ResponseOptions(
alignment=True, qualityScores=True, HTML=False
)
print(repository, modelId)
source = "1 2 3 4 5 6 7 8 9"
responses = service.translate(model, VectorString([source]), options)
for response in responses:
print(response.target.text, end="")
print()





if __name__ == '__main__':
test_basic()

0 comments on commit 46a160b

Please sign in to comment.