code: def test_CatalogRepository(tmp_path):
      (tmp_path / "loc1" / "xx" / "LC_MESSAGES").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path / "loc1" / "xx" / "LC_MESSAGES" / "test1.po"
      ).write_text("#", encoding="utf8")
      (
          tmp_path / "loc1" / "xx" / "LC_MESSAGES" / "test2.po"
      ).write_text("#", encoding="utf8")
      (tmp_path / "loc1" / "xx" / "LC_MESSAGES" / "sub").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path / "loc1" / "xx" / "LC_MESSAGES" / "sub" / "test3.po"
      ).write_text("#", encoding="utf8")
      (
          tmp_path / "loc1" / "xx" / "LC_MESSAGES" / "sub" / "test4.po"
      ).write_text("#", encoding="utf8")
      (tmp_path / "loc1" / "xx" / "LC_MESSAGES" / ".dotdir").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path
          / "loc1"
          / "xx"
          / "LC_MESSAGES"
          / ".dotdir"
          / "test5.po"
      ).write_text("#", encoding="utf8")
      (tmp_path / "loc1" / "yy" / "LC_MESSAGES").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path / "loc1" / "yy" / "LC_MESSAGES" / "test6.po"
      ).write_text("#", encoding="utf8")
      (tmp_path / "loc2" / "xx" / "LC_MESSAGES").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path / "loc2" / "xx" / "LC_MESSAGES" / "test1.po"
      ).write_text("#", encoding="utf8")
      (
          tmp_path / "loc2" / "xx" / "LC_MESSAGES" / "test7.po"
      ).write_text("#", encoding="utf8")
      (tmp_path / "loc1" / "xx" / "LC_MESSAGES" / ".dotdir2").mkdir(
          parents=True, exist_ok=True
      )
      (
          tmp_path
          / "loc1"
          / "xx"
          / "LC_MESSAGES"
          / ".dotdir2"
          / "test8.po"
      ).write_text("#", encoding="utf8")
  
      # for language xx
      repo = i18n.CatalogRepository(
          tmp_path, ["loc1", "loc2"], "xx", "utf-8"
      )
      assert list(repo.locale_dirs) == [
          str(tmp_path / "loc1"),
          str(tmp_path / "loc2"),
      ]
      assert all(isinstance(c, i18n.CatalogInfo) for c in repo.catalogs)
      assert sorted(c.domain for c in repo.catalogs) == [
          "sub/test3",
          "sub/test4",
          "test1",
          "test1",
          "test2",
          "test7",
      ]
  
      # for language yy
      repo = i18n.CatalogRepository(
          tmp_path, ["loc1", "loc2"], "yy", "utf-8"
      )
      assert sorted(c.domain for c in repo.catalogs) == ["test6"]
  
      # unknown languages
      repo = i18n.CatalogRepository(
          tmp_path, ["loc1", "loc2"], "zz", "utf-8"
      )
      assert sorted(c.domain for c in repo.catalogs) == []
  
      # no languages
      repo = i18n.CatalogRepository(
          tmp_path, ["loc1", "loc2"], None, "utf-8"
      )
      assert sorted(c.domain for c in repo.catalogs) == []
  
      # unknown locale_dirs
      repo = i18n.CatalogRepository(tmp_path, ["loc3"], None, "utf-8")
      assert sorted(c.domain for c in repo.catalogs) == []
  
      # no locale_dirs
      repo = i18n.CatalogRepository(tmp_path, [], None, "utf-8")
      assert sorted(c.domain for c in repo.catalogs) == []
  
file_path: sphinx/tests/test_util/test_util_i18n.py
imports: import datetime
  import os
  import babel
  import pytest
  from babel.messages.mofile import read_mo
  from sphinx.errors import SphinxError
  from sphinx.util import i18n
label_desc: Use image node_id 7 for calling a global function with example usage: test_CatalogRepository(tmp_path) without return types