test_parsable.py 555 B

123456789101112131415
  1. from gflanguages import DATA_DIR
  2. import glob
  3. import os
  4. import pytest
  5. from gflanguages import languages_public_pb2
  6. from google.protobuf import text_format
  7. languages_dir = os.path.join(DATA_DIR, "languages")
  8. textproto_files = [os.path.basename(x) for x in glob.iglob(os.path.join(languages_dir, "*.textproto"))]
  9. @pytest.mark.parametrize("lang_code", textproto_files)
  10. def test_parsable(lang_code):
  11. with open(os.path.join(languages_dir, lang_code), "r", encoding="utf-8") as f:
  12. text_format.Parse(f.read(), languages_public_pb2.LanguageProto())