conftest.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import pytest
  2. @pytest.fixture
  3. def sample_prompts():
  4. return [
  5. "Hello, my name is",
  6. "The president of the United States is",
  7. "The capital of France is",
  8. "The future of AI is",
  9. ]
  10. @pytest.fixture
  11. def sample_token_ids():
  12. return [
  13. [0],
  14. [0, 1],
  15. [0, 2, 1],
  16. [0, 3, 1, 2],
  17. ]
  18. @pytest.fixture
  19. def sample_regex():
  20. return (r"((25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.){3}"
  21. r"(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)")
  22. @pytest.fixture
  23. def sample_json_schema():
  24. return {
  25. "type": "object",
  26. "properties": {
  27. "name": {
  28. "type": "string"
  29. },
  30. "age": {
  31. "type": "integer"
  32. },
  33. "skills": {
  34. "type": "array",
  35. "items": {
  36. "type": "string",
  37. "maxLength": 10
  38. },
  39. "minItems": 3
  40. },
  41. "work_history": {
  42. "type": "array",
  43. "items": {
  44. "type": "object",
  45. "properties": {
  46. "company": {
  47. "type": "string"
  48. },
  49. "duration": {
  50. "type": "number"
  51. },
  52. "position": {
  53. "type": "string"
  54. }
  55. },
  56. "required": ["company", "position"]
  57. }
  58. }
  59. },
  60. "required": ["name", "age", "skills", "work_history"]
  61. }
  62. @pytest.fixture
  63. def sample_guided_choice():
  64. return [
  65. "Python", "Java", "JavaScript", "C++", "C#", "PHP", "TypeScript",
  66. "Ruby", "Swift", "Kotlin"
  67. ]
  68. @pytest.fixture
  69. def sample_sql_statements():
  70. return ("""
  71. start: select_statement
  72. select_statement: "SELECT" column "from" table "where" condition
  73. column: "col_1" | "col_2"
  74. table: "table_1" | "table_2"
  75. condition: column "=" number
  76. number: "1" | "2"
  77. """)