genlayer-test 0.8.0__tar.gz → 0.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/PKG-INFO +77 -177
  2. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/README.md +76 -176
  3. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/genlayer_test.egg-info/PKG-INFO +77 -177
  4. genlayer_test-0.10.0/genlayer_test.egg-info/SOURCES.txt +41 -0
  5. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/genlayer_test.egg-info/top_level.txt +0 -2
  6. genlayer_test-0.10.0/gltest/fixtures.py +38 -0
  7. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/constants.py +6 -0
  8. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/plugin.py +19 -12
  9. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/types.py +70 -49
  10. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/user.py +79 -7
  11. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/pyproject.toml +2 -1
  12. genlayer_test-0.8.0/genlayer_test.egg-info/SOURCES.txt +0 -85
  13. genlayer_test-0.8.0/gltest/fixtures.py +0 -87
  14. genlayer_test-0.8.0/tests/__init__.py +0 -0
  15. genlayer_test-0.8.0/tests/conftest.py +0 -1
  16. genlayer_test-0.8.0/tests/examples/contracts/football_prediction_market.py +0 -100
  17. genlayer_test-0.8.0/tests/examples/contracts/intelligent_oracle.py +0 -370
  18. genlayer_test-0.8.0/tests/examples/contracts/intelligent_oracle_factory.py +0 -49
  19. genlayer_test-0.8.0/tests/examples/contracts/invalid_deploy.py +0 -10
  20. genlayer_test-0.8.0/tests/examples/contracts/llm_erc20.py +0 -70
  21. genlayer_test-0.8.0/tests/examples/contracts/log_indexer.py +0 -69
  22. genlayer_test-0.8.0/tests/examples/contracts/multi_file_contract/__init__.py +0 -24
  23. genlayer_test-0.8.0/tests/examples/contracts/multi_file_contract/other.py +0 -14
  24. genlayer_test-0.8.0/tests/examples/contracts/multi_read_erc20.py +0 -29
  25. genlayer_test-0.8.0/tests/examples/contracts/multi_tenant_storage.py +0 -51
  26. genlayer_test-0.8.0/tests/examples/contracts/read_erc20.py +0 -19
  27. genlayer_test-0.8.0/tests/examples/contracts/simple_time_contract.py +0 -85
  28. genlayer_test-0.8.0/tests/examples/contracts/storage.py +0 -23
  29. genlayer_test-0.8.0/tests/examples/contracts/user_storage.py +0 -25
  30. genlayer_test-0.8.0/tests/examples/contracts/wizard_of_coin.py +0 -57
  31. genlayer_test-0.8.0/tests/examples/tests/test_custom_validators.py +0 -65
  32. genlayer_test-0.8.0/tests/examples/tests/test_football_prediction_market.py +0 -38
  33. genlayer_test-0.8.0/tests/examples/tests/test_intelligent_oracle_factory.py +0 -162
  34. genlayer_test-0.8.0/tests/examples/tests/test_invalid_deploy.py +0 -24
  35. genlayer_test-0.8.0/tests/examples/tests/test_llm_erc20.py +0 -60
  36. genlayer_test-0.8.0/tests/examples/tests/test_llm_erc20_analyze.py +0 -54
  37. genlayer_test-0.8.0/tests/examples/tests/test_log_indexer.py +0 -76
  38. genlayer_test-0.8.0/tests/examples/tests/test_multi_file_contract.py +0 -15
  39. genlayer_test-0.8.0/tests/examples/tests/test_multi_read_erc20.py +0 -103
  40. genlayer_test-0.8.0/tests/examples/tests/test_multi_tenant_storage.py +0 -76
  41. genlayer_test-0.8.0/tests/examples/tests/test_read_erc20.py +0 -38
  42. genlayer_test-0.8.0/tests/examples/tests/test_simple_time_contract.py +0 -90
  43. genlayer_test-0.8.0/tests/examples/tests/test_storage.py +0 -26
  44. genlayer_test-0.8.0/tests/examples/tests/test_user_storage.py +0 -87
  45. genlayer_test-0.8.0/tests/examples/tests/test_wizard_of_coin.py +0 -27
  46. genlayer_test-0.8.0/tests/gltest/__init__.py +0 -0
  47. genlayer_test-0.8.0/tests/gltest/artifact/__init__.py +0 -0
  48. genlayer_test-0.8.0/tests/gltest/artifact/contracts/duplicate_ic_contract_1.py +0 -22
  49. genlayer_test-0.8.0/tests/gltest/artifact/contracts/duplicate_ic_contract_2.py +0 -22
  50. genlayer_test-0.8.0/tests/gltest/artifact/contracts/not_ic_contract.py +0 -22
  51. genlayer_test-0.8.0/tests/gltest/artifact/test_contract_definition.py +0 -55
  52. genlayer_test-0.8.0/tests/gltest/assertions/test_assertions.py +0 -344
  53. genlayer_test-0.8.0/tests/gltest_cli/__init__.py +0 -0
  54. genlayer_test-0.8.0/tests/gltest_cli/config/test_config_integration.py +0 -432
  55. genlayer_test-0.8.0/tests/gltest_cli/config/test_general_config.py +0 -406
  56. genlayer_test-0.8.0/tests/gltest_cli/config/test_plugin.py +0 -290
  57. genlayer_test-0.8.0/tests/gltest_cli/config/test_user.py +0 -411
  58. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/LICENSE +0 -0
  59. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/genlayer_test.egg-info/dependency_links.txt +0 -0
  60. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/genlayer_test.egg-info/entry_points.txt +0 -0
  61. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/genlayer_test.egg-info/requires.txt +0 -0
  62. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/__init__.py +0 -0
  63. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/accounts.py +0 -0
  64. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/artifacts/__init__.py +0 -0
  65. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/artifacts/contract.py +0 -0
  66. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/assertions.py +0 -0
  67. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/clients.py +0 -0
  68. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/__init__.py +0 -0
  69. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/contract.py +0 -0
  70. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/contract_factory.py +0 -0
  71. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/contract_functions.py +0 -0
  72. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/method_stats.py +0 -0
  73. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/stats_collector.py +0 -0
  74. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/contracts/utils.py +0 -0
  75. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/exceptions.py +0 -0
  76. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/helpers/__init__.py +0 -0
  77. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/helpers/fixture_snapshot.py +0 -0
  78. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/helpers/take_snapshot.py +0 -0
  79. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/logging.py +0 -0
  80. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/types.py +0 -0
  81. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/utils.py +0 -0
  82. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/validators/__init__.py +0 -0
  83. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest/validators/validator_factory.py +0 -0
  84. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/__init__.py +0 -0
  85. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/general.py +0 -0
  86. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/config/pytest_context.py +0 -0
  87. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/logging.py +0 -0
  88. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/gltest_cli/main.py +0 -0
  89. {genlayer_test-0.8.0 → genlayer_test-0.10.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genlayer-test
3
- Version: 0.8.0
3
+ Version: 0.10.0
4
4
  Summary: GenLayer Testing Suite
5
5
  Author: GenLayer
6
6
  License-Expression: MIT
@@ -140,6 +140,7 @@ networks:
140
140
  custom_network: # Custom network configuration
141
141
  id: 1234
142
142
  url: "http://custom.network:8545"
143
+ chain_type: "localnet" # Required for custom networks: localnet, studionet, or testnet_asimov
143
144
  accounts:
144
145
  - "${CUSTOM_ACCOUNT_1}"
145
146
  - "${CUSTOM_ACCOUNT_2}"
@@ -163,10 +164,11 @@ Key configuration sections:
163
164
  - Network configurations can include:
164
165
  - `url`: The RPC endpoint for the network (optional for pre-configured networks)
165
166
  - `id`: Chain ID (optional for pre-configured networks)
167
+ - `chain_type`: Chain type - one of: `localnet`, `studionet`, or `testnet_asimov` (required for custom networks)
166
168
  - `accounts`: List of account private keys (using environment variables)
167
169
  - `from`: Specify which account to use as the default for transactions (optional, defaults to first account)
168
170
  - `leader_only`: Leader only mode
169
- - For custom networks (non-pre-configured), `id`, `url`, and `accounts` are required fields
171
+ - For custom networks (non-pre-configured), `id`, `url`, `chain_type`, and `accounts` are required fields
170
172
 
171
173
  **Note on Environment Variables**: When using environment variables in your configuration (e.g., `${ACCOUNT_PRIVATE_KEY_1}`), ensure they are properly set in your `environment` file. If an environment variable is not found, the system will raise a clear error message indicating which variable is missing.
172
174
 
@@ -182,6 +184,13 @@ testnet_asimov:
182
184
  from: "${ADMIN_KEY}" # Use ADMIN_KEY as default instead of DEPLOYER_KEY
183
185
  ```
184
186
 
187
+ **Chain vs Network**:
188
+ - **Network**: Defines the connection details (URL, accounts, etc.) for a specific environment
189
+ - **Chain**: Defines the genlayer chain type and its associated behaviors (localnet, studionet, or testnet_asimov)
190
+ - Pre-configured networks automatically have the correct chain type set
191
+ - Custom networks must specify the chain type explicitly
192
+ - The `--chain-type` CLI flag can override the chain type for any network, allowing you to test different chain behaviors with the same network configuration
193
+
185
194
  2. **Paths**: Define important directory paths
186
195
  - `contracts`: Location of your contract files
187
196
  - `artifacts`: Location of your artifacts files (analysis results will be stored here)
@@ -261,31 +270,7 @@ $ gltest --default-wait-interval <default_wait_interval>
261
270
  $ gltest --default-wait-retries <default_wait_retries>
262
271
  ```
263
272
 
264
- 10. Run tests with mocked LLM responses (localnet only)
265
- ```bash
266
- $ gltest --test-with-mocks
267
- ```
268
- The `--test-with-mocks` flag enables mocking of LLM responses when creating validators. This is particularly useful for:
269
- - Testing without actual LLM API calls
270
- - Ensuring deterministic test results
271
- - Faster test execution
272
- - Testing specific edge cases with controlled responses
273
-
274
- When using this flag with the `setup_validators` fixture, you can provide custom mock responses:
275
- ```python
276
- def test_with_mocked_llm(setup_validators):
277
- # Setup validators with a specific mock response
278
- mock_response = {"result": "This is a mocked LLM response"}
279
- setup_validators(mock_response=mock_response)
280
-
281
- # Your LLM-based contract will receive the mocked response
282
- contract = factory.deploy()
283
- result = contract.llm_method() # Will use the mocked response
284
- ```
285
-
286
- Note: This feature is only available when running tests on localnet.
287
-
288
- 11. Run tests with leader-only mode enabled
273
+ 10. Run tests with leader-only mode enabled
289
274
  ```bash
290
275
  $ gltest --leader-only
291
276
  ```
@@ -299,6 +284,24 @@ When this flag is enabled, all contracts deployed and all write transactions wil
299
284
 
300
285
  **Note:** Leader-only mode is only available for studio-based networks (localhost, 127.0.0.1, *.genlayer.com, *.genlayerlabs.com). When enabled on other networks, it will have no effect and a warning will be logged.
301
286
 
287
+ 12. Override the chain type
288
+ ```bash
289
+ $ gltest --chain-type localnet
290
+ $ gltest --chain-type studionet
291
+ $ gltest --chain-type testnet_asimov
292
+ ```
293
+ The `--chain-type` flag allows you to override the chain type configured for the network. This is useful when:
294
+ - Testing different chain behaviors without changing network configuration
295
+ - Switching between chain types for testing purposes
296
+ - Using a custom network URL with a specific chain type
297
+
298
+ Available chain types:
299
+ - `localnet`: Local development chain
300
+ - `studionet`: Studio-based chain
301
+ - `testnet_asimov`: Testnet Asimov chain
302
+
303
+ The chain type determines various behaviors including RPC endpoints, consensus mechanisms, and available features. When specified, this flag overrides the chain type configured in your network settings.
304
+
302
305
  ## 🚀 Key Features
303
306
 
304
307
  - **Pytest Integration** – Extends pytest to support intelligent contract testing, making it familiar and easy to adopt.
@@ -448,7 +451,7 @@ def test_write_methods():
448
451
  ).transact(
449
452
  value=0, # Optional: amount of native currency to send
450
453
  consensus_max_rotations=3, # Optional: max consensus rotations
451
- wait_interval=1, # Optional: seconds between status checks
454
+ wait_interval=1000, # Optional: milliseconds between status checks
452
455
  wait_retries=10, # Optional: max number of retries
453
456
  transaction_context=None, # Optional: custom transaction context
454
457
  )
@@ -511,7 +514,6 @@ The following fixtures are available in `gltest.fixtures`:
511
514
  - **`gl_client`** (session scope) - GenLayer client instance for network operations
512
515
  - **`default_account`** (session scope) - Default account for testing and deployments
513
516
  - **`accounts`** (session scope) - List of test accounts for multi-account scenarios
514
- - **`setup_validators`** (function scope) - Function to create test validators for LLM operations
515
517
 
516
518
  ##### 1. `gl_client` (session scope)
517
519
  Provides a GenLayer PY client instance that's created once per test session. This is useful for operations that interact directly with the GenLayer network.
@@ -546,26 +548,6 @@ def test_multiple_accounts(accounts):
546
548
  contract.transfer(args=[receiver.address, 100], account=sender)
547
549
  ```
548
550
 
549
- ##### 4. `setup_validators` (function scope)
550
- Creates test validators for localnet environment. This fixture is particularly useful for testing LLM-based contract methods and consensus behavior. It yields a function that allows you to configure validators with custom settings.
551
-
552
- ```python
553
- def test_with_validators(setup_validators):
554
- # Setup validators with default configuration
555
- setup_validators()
556
-
557
- # Or setup with custom mock responses for testing
558
- mock_response = {"result": "mocked LLM response"}
559
- setup_validators(mock_response=mock_response, n_validators=3)
560
-
561
- # Now test your LLM-based contract methods
562
- contract = factory.deploy()
563
- result = contract.llm_based_method()
564
- ```
565
-
566
- Parameters for `setup_validators`:
567
- - `mock_response` (dict, optional): Mock validator response when using `--test-with-mocks` flag
568
- - `n_validators` (int, optional): Number of validators to create (default: 5)
569
551
 
570
552
  #### Using Fixtures in Your Tests
571
553
 
@@ -575,9 +557,7 @@ To use these fixtures, simply import them and include them as parameters in your
575
557
  from gltest import get_contract_factory
576
558
  from gltest.assertions import tx_execution_succeeded
577
559
 
578
- def test_complete_workflow(gl_client, default_account, accounts, setup_validators):
579
- # Setup validators for LLM operations
580
- setup_validators()
560
+ def test_complete_workflow(gl_client, default_account, accounts):
581
561
 
582
562
  # Deploy contract with default account
583
563
  factory = get_contract_factory("MyContract")
@@ -623,7 +603,7 @@ def test_analyze_method():
623
603
  print(f"Reliability score: {analysis.reliability_score:.2f}%")
624
604
  print(f"Unique states: {analysis.unique_states}")
625
605
  print(f"Execution time: {analysis.execution_time:.1f}s")
626
-
606
+
627
607
  # The analysis returns a MethodStatsSummary object with:
628
608
  # - method: The contract method name
629
609
  # - args: Arguments passed to the method
@@ -641,127 +621,6 @@ The `.analyze()` method helps you:
641
621
  - Identify edge cases and failure patterns
642
622
  - Benchmark performance across multiple runs
643
623
 
644
- ### Mock LLM Responses
645
-
646
- The Mock LLM system allows you to simulate Large Language Model responses in GenLayer tests. This is essential for creating deterministic tests by providing predefined responses instead of relying on actual LLM calls.
647
-
648
- #### Basic Structure
649
-
650
- The mock system consists of a response dictionary that maps GenLayer methods to their mocked responses:
651
-
652
- ```python
653
- mock_response = {
654
- "response": {}, # Optional: mocks gl.nondet.exec_prompt
655
- "eq_principle_prompt_comparative": {}, # Optional: mocks gl.eq_principle.prompt_comparative
656
- "eq_principle_prompt_non_comparative": {} # Optional: mocks gl.eq_principle.prompt_non_comparative
657
- }
658
-
659
- setup_validators(mock_response)
660
- ```
661
-
662
- #### Method Mappings
663
-
664
- | Mock Key | GenLayer Method |
665
- |----------|----------------|
666
- | `"response"` | `gl.nondet.exec_prompt` |
667
- | `"eq_principle_prompt_comparative"` | `gl.eq_principle.prompt_comparative` |
668
- | `"eq_principle_prompt_non_comparative"` | `gl.eq_principle.prompt_non_comparative` |
669
-
670
- #### How It Works
671
-
672
- The mock system works by pattern matching against the user message that gets built internally. When a GenLayer method is called:
673
-
674
- 1. A user message is constructed internally (`<user_message>`)
675
- 2. The mock system searches for strings within that message
676
- 3. If a matching string is found in the mock dictionary, the associated response is returned
677
-
678
- ##### String Matching Rules
679
-
680
- The system performs **substring matching** on the user message. The key in your mock dictionary must be contained within the actual user message.
681
-
682
- #### Examples
683
-
684
- ##### Basic Example
685
-
686
- ```python
687
- # Mock setup
688
- mock_response = {
689
- "eq_principle_prompt_comparative": {
690
- "The value of give_coin has to match": True
691
- }
692
- }
693
- setup_validators(mock_response)
694
-
695
- # In your contract
696
- result = gl.eq_principle.prompt_comparative(
697
- get_wizard_answer,
698
- "The value of give_coin has to match" # This string will be matched
699
- )
700
- # result will be True
701
- ```
702
-
703
- ##### Substring Matching Examples
704
-
705
- ✅ **Will work** - Partial match:
706
- ```python
707
- "eq_principle_prompt_comparative": {
708
- "The value of give_coin": True # Substring of the full message
709
- }
710
- ```
711
-
712
- ❌ **Won't work** - Extra words break the match:
713
- ```python
714
- "eq_principle_prompt_comparative": {
715
- "The good value of give_coin": True # "good" is not in the actual message
716
- }
717
- ```
718
-
719
- ##### Complete Example
720
-
721
- ```python
722
- from gltest import get_contract_factory
723
- from gltest.fixtures import setup_validators
724
-
725
- def test_with_mocked_llm(setup_validators):
726
- # Define mock responses
727
- mock_response = {
728
- "response": {
729
- "What is the weather?": "It's sunny today",
730
- "Calculate 2+2": "4"
731
- },
732
- "eq_principle_prompt_comparative": {
733
- "values must be equal": True,
734
- "amounts should match": False
735
- },
736
- "eq_principle_prompt_non_comparative": {
737
- "Is this valid?": True
738
- }
739
- }
740
-
741
- # Initialize the mock system
742
- setup_validators(mock_response)
743
-
744
- # Deploy and test your contract
745
- factory = get_contract_factory("MyLLMContract")
746
- contract = factory.deploy()
747
-
748
- # Your LLM methods will use the mocked responses
749
- result = contract.check_weather() # Uses mocked response
750
- ```
751
-
752
- #### Best Practices
753
-
754
- 1. **Be specific with match strings**: Use unique substrings that won't accidentally match other prompts
755
- 2. **Test your matches**: Verify that your mock strings actually appear in the generated user messages
756
- 3. **Keep mocks simple**: Mock responses should be minimal and focused on the test case
757
- 4. **Document your mocks**: Comment why specific responses are mocked for future reference
758
- 5. **Use with `--test-with-mocks` flag**: Enable mocking when running tests: `gltest --test-with-mocks`
759
-
760
- #### Notes
761
-
762
- - Mock responses are only available when running tests on localnet
763
- - The `setup_validators` fixture handles the mock setup when provided with a mock_response
764
- - Mocking is particularly useful for CI/CD pipelines where deterministic results are required
765
624
 
766
625
  ### Custom Transaction Context
767
626
 
@@ -812,17 +671,58 @@ def test_with_custom_transaction_context():
812
671
  )
813
672
  ```
814
673
 
674
+ ### Mock LLM Responses
675
+
676
+ The Mock LLM system allows you to simulate Large Language Model responses in GenLayer tests. This is essential for creating deterministic tests by providing predefined responses instead of relying on actual LLM calls.
677
+
678
+ #### Basic Structure
679
+
680
+ The mock system consists of a response dictionary that maps GenLayer methods to their mocked responses:
681
+
682
+ ```python
683
+ from gltest.types import MockedLLMResponse
684
+
685
+ mock_response: MockedLLMResponse = {
686
+ "nondet_exec_prompt": {}, # Optional: mocks gl.nondet.exec_prompt
687
+ "eq_principle_prompt_comparative": {}, # Optional: mocks gl.eq_principle.prompt_comparative
688
+ "eq_principle_prompt_non_comparative": {} # Optional: mocks gl.eq_principle.prompt_non_comparative
689
+ }
690
+ ```
691
+
692
+ #### Method Mappings
693
+
694
+ | Mock Key | GenLayer Method |
695
+ |----------|----------------|
696
+ | `"nondet_exec_prompt"` | `gl.nondet.exec_prompt` |
697
+ | `"eq_principle_prompt_comparative"` | `gl.eq_principle.prompt_comparative` |
698
+ | `"eq_principle_prompt_non_comparative"` | `gl.eq_principle.prompt_non_comparative` |
699
+
700
+ #### How It Works
701
+
702
+ The mock system works by pattern matching against the user message that gets built internally. When a GenLayer method is called:
703
+
704
+ 1. A user message is constructed internally (`<user_message>`)
705
+ 2. The mock system searches for strings within that message
706
+ 3. If a matching string is found in the mock dictionary, the associated response is returned
707
+
708
+ ##### String Matching Rules
709
+
710
+ The system performs **substring matching** on the user message. The key in your mock dictionary must be contained within the actual user message.
711
+
712
+
815
713
  #### Mock Validators with Transaction Context
816
714
 
817
715
  Combine mock validators with custom datetime for fully deterministic tests:
818
716
 
819
717
  ```python
718
+ from gltest.types import MockedLLMResponse
719
+
820
720
  def test_with_mocked_context():
821
721
  factory = get_contract_factory("LLMContract")
822
722
  validator_factory = get_validator_factory()
823
723
 
824
724
  # Define mock LLM responses
825
- mock_response = {
725
+ mock_response: MockedLLMResponse = {
826
726
  "nondet_exec_prompt": {
827
727
  "analyze this": "positive sentiment"
828
728
  },
@@ -1014,7 +914,7 @@ def test_validator_cloning():
1014
914
  tx_receipt = contract.set_value(
1015
915
  args=["new_value"],
1016
916
  ).transact(
1017
- wait_interval=2, # Increase wait interval between status checks
917
+ wait_interval=2000, # Increase wait interval between status checks
1018
918
  wait_retries=20, # Increase number of retry attempts
1019
919
  )
1020
920
  ```
@@ -1031,7 +931,7 @@ def test_validator_cloning():
1031
931
  # For critical operations, use more conservative settings
1032
932
  contract = factory.deploy(
1033
933
  consensus_max_rotations=10, # More rotations for better reliability
1034
- wait_interval=3, # Longer wait between checks
934
+ wait_interval=3000, # Longer wait between checks
1035
935
  wait_retries=30 # More retries for consensus
1036
936
  )
1037
937
  ```