You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

преди 3 месеца
преди 3 месеца
преди 3 месеца
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. from cfg_aux import *
  2. def test_cfg_aux_textureName(
  3. ) -> str:
  4. section = "textures \"t-floor1\""
  5. tex = cfg_aux_textureName(section)
  6. if (
  7. tex == "t-floor1"
  8. ):
  9. return "OK: cfg_aux_textureName"
  10. return "ERR: cfg_aux_textureName"
  11. def test_cfg_aux_tree(
  12. ) -> str:
  13. lines = [
  14. "[abc]",
  15. "width = 100",
  16. "wrongSep=another",
  17. "[def]",
  18. "anotherWrongSep -> whatever",
  19. "title = yo",
  20. "subtitle = whoa",
  21. ]
  22. tree = cfg_aux_tree(lines)
  23. if (
  24. cld_len(tree) == 2 and
  25. cld_len(tree["abc"]) == 1 and
  26. cld_len(tree["def"]) == 2
  27. ):
  28. return "OK: cfg_aux_tree"
  29. return "ERR: cfg_aux_tree"
  30. def test_cfg_aux_treeCreateSection(
  31. ) -> str:
  32. tree: dict[str, dict[str, str]] = {}
  33. line = "[abc]"
  34. sectionName = cfg_aux_treeCreateSection(tree, line)
  35. if (
  36. sectionName == "abc" and
  37. cld_len(tree) == 1
  38. ):
  39. return "OK: cfg_aux_treeCreateSection"
  40. return "ERR: cfg_aux_treeCreateSection"
  41. def test_cfg_aux_treeSetKeyValue(
  42. ) -> str:
  43. tree: dict[str, dict[str, str]] = {}
  44. line = "[abc]"
  45. sectionName = cfg_aux_treeCreateSection(tree, line)
  46. line = "title = wazup"
  47. cfg_aux_treeSetKeyValue(tree, sectionName, line)
  48. if (
  49. cld_len(tree[sectionName]) == 1 and
  50. tree[sectionName]["title"] == "wazup"
  51. ):
  52. return "OK: cfg_aux_treeSetKeyValue"
  53. return "ERR: cfg_aux_treeSetKeyValue"