genlayer-test 0.7.0__py3-none-any.whl → 0.9.0__py3-none-any.whl

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 (58) hide show
  1. {genlayer_test-0.7.0.dist-info → genlayer_test-0.9.0.dist-info}/METADATA +245 -4
  2. genlayer_test-0.9.0.dist-info/RECORD +38 -0
  3. {genlayer_test-0.7.0.dist-info → genlayer_test-0.9.0.dist-info}/top_level.txt +0 -1
  4. gltest/__init__.py +3 -0
  5. gltest/types.py +12 -1
  6. gltest/validators/__init__.py +3 -0
  7. gltest/validators/validator_factory.py +136 -0
  8. gltest_cli/config/constants.py +7 -0
  9. gltest_cli/config/plugin.py +22 -4
  10. gltest_cli/config/types.py +81 -46
  11. gltest_cli/config/user.py +95 -7
  12. genlayer_test-0.7.0.dist-info/RECORD +0 -79
  13. tests/__init__.py +0 -0
  14. tests/conftest.py +0 -1
  15. tests/examples/contracts/football_prediction_market.py +0 -100
  16. tests/examples/contracts/intelligent_oracle.py +0 -370
  17. tests/examples/contracts/intelligent_oracle_factory.py +0 -49
  18. tests/examples/contracts/invalid_deploy.py +0 -10
  19. tests/examples/contracts/llm_erc20.py +0 -70
  20. tests/examples/contracts/log_indexer.py +0 -69
  21. tests/examples/contracts/multi_file_contract/__init__.py +0 -24
  22. tests/examples/contracts/multi_file_contract/other.py +0 -14
  23. tests/examples/contracts/multi_read_erc20.py +0 -29
  24. tests/examples/contracts/multi_tenant_storage.py +0 -51
  25. tests/examples/contracts/read_erc20.py +0 -19
  26. tests/examples/contracts/simple_time_contract.py +0 -85
  27. tests/examples/contracts/storage.py +0 -23
  28. tests/examples/contracts/user_storage.py +0 -25
  29. tests/examples/contracts/wizard_of_coin.py +0 -57
  30. tests/examples/tests/test_football_prediction_market.py +0 -38
  31. tests/examples/tests/test_intelligent_oracle_factory.py +0 -162
  32. tests/examples/tests/test_invalid_deploy.py +0 -24
  33. tests/examples/tests/test_llm_erc20.py +0 -60
  34. tests/examples/tests/test_llm_erc20_analyze.py +0 -54
  35. tests/examples/tests/test_log_indexer.py +0 -76
  36. tests/examples/tests/test_multi_file_contract.py +0 -15
  37. tests/examples/tests/test_multi_read_erc20.py +0 -103
  38. tests/examples/tests/test_multi_tenant_storage.py +0 -76
  39. tests/examples/tests/test_read_erc20.py +0 -38
  40. tests/examples/tests/test_simple_time_contract.py +0 -90
  41. tests/examples/tests/test_storage.py +0 -26
  42. tests/examples/tests/test_user_storage.py +0 -87
  43. tests/examples/tests/test_wizard_of_coin.py +0 -27
  44. tests/gltest/__init__.py +0 -0
  45. tests/gltest/artifact/__init__.py +0 -0
  46. tests/gltest/artifact/contracts/duplicate_ic_contract_1.py +0 -22
  47. tests/gltest/artifact/contracts/duplicate_ic_contract_2.py +0 -22
  48. tests/gltest/artifact/contracts/not_ic_contract.py +0 -22
  49. tests/gltest/artifact/test_contract_definition.py +0 -55
  50. tests/gltest/assertions/test_assertions.py +0 -344
  51. tests/gltest_cli/__init__.py +0 -0
  52. tests/gltest_cli/config/test_config_integration.py +0 -432
  53. tests/gltest_cli/config/test_general_config.py +0 -406
  54. tests/gltest_cli/config/test_plugin.py +0 -290
  55. tests/gltest_cli/config/test_user.py +0 -411
  56. {genlayer_test-0.7.0.dist-info → genlayer_test-0.9.0.dist-info}/WHEEL +0 -0
  57. {genlayer_test-0.7.0.dist-info → genlayer_test-0.9.0.dist-info}/entry_points.txt +0 -0
  58. {genlayer_test-0.7.0.dist-info → genlayer_test-0.9.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,103 +0,0 @@
1
- from gltest import get_contract_factory, create_account, get_accounts
2
- from gltest.assertions import tx_execution_succeeded
3
- from gltest_cli.config.general import get_general_config
4
- from genlayer_py.chains import testnet_asimov
5
-
6
-
7
- def test_multi_read_erc20(setup_validators):
8
- """
9
- This test verifies the functionality of a multi-read ERC20 contract. It deploys two separate ERC20 token contracts
10
- (referred to as 'doge' and 'shiba') and a multi-read ERC20 contract. The test aims to:
11
-
12
- 1. Deploy two different ERC20 token contracts with a total supply of 1000 tokens each.
13
- 2. Deploy a multi-read ERC20 contract that can interact with multiple ERC20 tokens.
14
- 3. Test the ability of the multi-read contract to update and retrieve token balances for multiple ERC20 tokens
15
- and multiple accounts simultaneously.
16
- 4. Ensure the multi-read contract correctly maintains and reports balances for different account-token combinations.
17
-
18
- This test demonstrates the integration contract to contract reads
19
- """
20
- setup_validators()
21
- general_config = get_general_config()
22
- chain = general_config.get_chain()
23
-
24
- TOKEN_TOTAL_SUPPLY = 1000
25
-
26
- if chain.id == testnet_asimov.id:
27
- accounts = get_accounts()
28
- if len(accounts) < 2:
29
- raise ValueError(
30
- f"Test requires at least 2 accounts, but only {len(accounts)} available"
31
- )
32
- from_account_doge = accounts[0]
33
- from_account_shiba = accounts[1]
34
- else:
35
- from_account_doge = create_account()
36
- from_account_shiba = create_account()
37
-
38
- # LLM ERC20
39
- llm_erc20_factory = get_contract_factory("LlmErc20")
40
-
41
- ## Deploy first LLM ERC20 Contract
42
- doge_contract = llm_erc20_factory.deploy(
43
- args=[TOKEN_TOTAL_SUPPLY], account=from_account_doge
44
- )
45
-
46
- ## Deploy second LLM ERC20 Contract
47
- shiba_contract = llm_erc20_factory.deploy(
48
- args=[TOKEN_TOTAL_SUPPLY], account=from_account_shiba
49
- )
50
-
51
- # Deploy Multi Read ERC20 Contract
52
- multi_read_erc20_factory = get_contract_factory("multi_read_erc20")
53
-
54
- multi_read_contract = multi_read_erc20_factory.deploy(
55
- args=[], account=from_account_doge
56
- )
57
-
58
- # update balances for doge account
59
- transaction_response_call = multi_read_contract.update_token_balances(
60
- args=[
61
- from_account_doge.address,
62
- [doge_contract.address, shiba_contract.address],
63
- ]
64
- ).transact()
65
- assert tx_execution_succeeded(transaction_response_call)
66
-
67
- # check balances
68
- call_method_response_get_balances = multi_read_contract.get_balances(args=[]).call()
69
- assert call_method_response_get_balances == {
70
- from_account_doge.address: {
71
- doge_contract.address: TOKEN_TOTAL_SUPPLY,
72
- shiba_contract.address: 0,
73
- }
74
- }
75
-
76
- # update balances for shiba account
77
- transaction_response_call = (
78
- multi_read_contract.connect(from_account_shiba)
79
- .update_token_balances(
80
- args=[
81
- from_account_shiba.address,
82
- [doge_contract.address, shiba_contract.address],
83
- ]
84
- )
85
- .transact()
86
- )
87
- assert tx_execution_succeeded(transaction_response_call)
88
-
89
- # check balances
90
- call_method_response_get_balances = (
91
- multi_read_contract.connect(from_account_shiba).get_balances(args=[]).call()
92
- )
93
-
94
- assert call_method_response_get_balances == {
95
- from_account_doge.address: {
96
- doge_contract.address: TOKEN_TOTAL_SUPPLY,
97
- shiba_contract.address: 0,
98
- },
99
- from_account_shiba.address: {
100
- doge_contract.address: 0,
101
- shiba_contract.address: TOKEN_TOTAL_SUPPLY,
102
- },
103
- }
@@ -1,76 +0,0 @@
1
- from gltest import get_contract_factory, create_account, get_accounts
2
- from gltest.assertions import tx_execution_succeeded
3
- from gltest_cli.config.general import get_general_config
4
- from genlayer_py.chains import testnet_asimov
5
-
6
-
7
- def test_multi_tenant_storage(setup_validators):
8
- """
9
- This test verifies the functionality of a multi-tenant storage contract. It deploys two separate storage contracts
10
- and a multi-tenant storage contract that manages them. The test aims to:
11
-
12
- 1. Deploy two different storage contracts with initial storage values.
13
- 2. Deploy a multi-tenant storage contract that can interact with multiple storage contracts.
14
- 3. Test the ability of the multi-tenant contract to update and retrieve storage values for multiple users
15
- across different storage contracts.
16
- 4. Ensure the multi-tenant contract correctly assigns users to storage contracts and manages their data.
17
-
18
- This test demonstrates contract-to-contract interactions and multi-tenant data management.
19
- """
20
- setup_validators()
21
- general_config = get_general_config()
22
- chain = general_config.get_chain()
23
-
24
- if chain.id == testnet_asimov.id:
25
- user_account_a = get_accounts()[0]
26
- user_account_b = get_accounts()[1]
27
- else:
28
- user_account_a = create_account()
29
- user_account_b = create_account()
30
-
31
- # Storage Contracts
32
- storage_factory = get_contract_factory("Storage")
33
-
34
- ## Deploy first Storage Contract
35
- first_storage_contract = storage_factory.deploy(args=["initial_storage_a"])
36
-
37
- ## Deploy second Storage Contract
38
- second_storage_contract = storage_factory.deploy(args=["initial_storage_b"])
39
-
40
- # Deploy Multi Tenant Storage Contract
41
- multi_tenant_storage_factory = get_contract_factory("MultiTentantStorage")
42
- multi_tenant_storage_contract = multi_tenant_storage_factory.deploy(
43
- args=[
44
- [
45
- first_storage_contract.address,
46
- second_storage_contract.address,
47
- ]
48
- ]
49
- )
50
- # update storage for first contract
51
- transaction_response_call = (
52
- multi_tenant_storage_contract.connect(account=user_account_a)
53
- .update_storage(args=["user_a_storage"])
54
- .transact(
55
- wait_triggered_transactions=True,
56
- )
57
- )
58
- assert tx_execution_succeeded(transaction_response_call)
59
-
60
- # update storage for second contract
61
- transaction_response_call = (
62
- multi_tenant_storage_contract.connect(account=user_account_b)
63
- .update_storage(args=["user_b_storage"])
64
- .transact(
65
- wait_triggered_transactions=True,
66
- )
67
- )
68
- assert tx_execution_succeeded(transaction_response_call)
69
-
70
- # get all storages
71
- storages = multi_tenant_storage_contract.get_all_storages(args=[]).call()
72
-
73
- assert storages == {
74
- second_storage_contract.address: "user_a_storage",
75
- first_storage_contract.address: "user_b_storage",
76
- }
@@ -1,38 +0,0 @@
1
- from gltest import get_contract_factory, get_default_account
2
-
3
-
4
- def test_read_erc20(setup_validators):
5
- """
6
- Tests that recursive contract calls work by:
7
- 1. creating an LLM ERC20 contract
8
- 2. creating a read_erc20 contract that reads the LLM ERC20 contract
9
- 3. creating a read_erc20 contract that reads the previous read_erc20 contract
10
- Repeats step 3 a few times.
11
-
12
- It's like a linked list, but with contracts.
13
- """
14
- setup_validators()
15
- TOKEN_TOTAL_SUPPLY = 1000
16
-
17
- # LLM ERC20
18
- llm_erc20_factory = get_contract_factory("LlmErc20")
19
-
20
- # Deploy Contract
21
- llm_erc20_contract = llm_erc20_factory.deploy(args=[TOKEN_TOTAL_SUPPLY])
22
- last_contract_address = llm_erc20_contract.address
23
-
24
- # Read ERC20
25
- read_erc20_factory = get_contract_factory("read_erc20")
26
-
27
- for i in range(5):
28
- print(f"Deploying contract, iteration {i}")
29
-
30
- # deploy contract
31
- read_erc20_contract = read_erc20_factory.deploy(args=[last_contract_address])
32
- last_contract_address = read_erc20_contract.address
33
-
34
- # check balance
35
- contract_state = read_erc20_contract.get_balance_of(
36
- args=[get_default_account().address]
37
- ).call()
38
- assert contract_state == TOKEN_TOTAL_SUPPLY
@@ -1,90 +0,0 @@
1
- from gltest import get_contract_factory
2
- from datetime import datetime, timedelta, timezone
3
- from gltest.assertions import tx_execution_succeeded, tx_execution_failed
4
-
5
-
6
- def test_simple_time_contract():
7
- """Test all time-based functionality in a single comprehensive test."""
8
-
9
- factory = get_contract_factory("SimpleTimeContract")
10
-
11
- # Test 1: Deploy with past start date (10 days ago)
12
- now = datetime.now(timezone.utc)
13
- past_date = (now - timedelta(days=10)).isoformat()
14
- contract = factory.deploy(args=[past_date])
15
-
16
- # Test 1: Check initial status (10 days after start)
17
- status = contract.get_status().call()
18
- assert status["is_active"] == False
19
- assert status["days_since_start"] == 10
20
- assert status["can_activate"] == True
21
-
22
- # Test 2: Try to activate before start date (simulate going back in time)
23
- before_start_date = now - timedelta(days=15) # 5 days before start
24
- before_start_date_receipt = contract.activate().transact(
25
- transaction_context={
26
- "genvm_datetime": before_start_date.isoformat(),
27
- },
28
- )
29
- assert tx_execution_failed(before_start_date_receipt)
30
-
31
- # Test 3: Activate after start date
32
- activate_date = now - timedelta(days=5) # 5 days after start (15 days ago + 10)
33
- activate_receipt = contract.activate().transact(
34
- transaction_context={
35
- "genvm_datetime": activate_date.isoformat(),
36
- },
37
- )
38
- assert tx_execution_succeeded(activate_receipt)
39
-
40
- # Test 4: Verify activation and check status
41
- status = contract.get_status().call(
42
- transaction_context={
43
- "genvm_datetime": activate_date.isoformat(),
44
- },
45
- )
46
- assert status["is_active"] == True
47
- assert status["days_since_start"] == 5
48
- assert status["can_set_data"] == True
49
-
50
- # Test 5: Set data within valid period (within 30 days)
51
- set_data_date = now - timedelta(days=2) # 8 days after start
52
- test_data = "Test data within valid period"
53
- set_data_receipt = contract.set_data(
54
- args=[test_data],
55
- ).transact(
56
- transaction_context={
57
- "genvm_datetime": set_data_date.isoformat(),
58
- }
59
- )
60
- assert tx_execution_succeeded(set_data_receipt)
61
-
62
- # Test 6: Verify data was set
63
- status = contract.get_status().call(
64
- transaction_context={
65
- "genvm_datetime": set_data_date.isoformat(),
66
- },
67
- )
68
- assert status["data"] == test_data
69
- assert status["days_since_start"] == 8
70
-
71
- # Test 7: Try to set data after 30 days (should fail)
72
- expired_date = now + timedelta(days=25) # 35 days after start
73
- expired_date_receipt = contract.set_data(
74
- args=["Should fail - expired"],
75
- ).transact(
76
- transaction_context={
77
- "genvm_datetime": expired_date.isoformat(),
78
- }
79
- )
80
- assert tx_execution_failed(expired_date_receipt)
81
-
82
- # Test 8: Check status shows expired
83
- status = contract.get_status().call(
84
- transaction_context={
85
- "genvm_datetime": expired_date.isoformat(),
86
- },
87
- )
88
- assert status["is_active"] == True # Still active
89
- assert status["can_set_data"] == False # But can't set data
90
- assert status["days_since_start"] == 35
@@ -1,26 +0,0 @@
1
- from gltest import get_contract_factory
2
- from gltest.assertions import tx_execution_succeeded
3
-
4
-
5
- INITIAL_STATE = "a"
6
- UPDATED_STATE = "b"
7
-
8
-
9
- def test_storage(setup_validators):
10
- setup_validators()
11
- factory = get_contract_factory("Storage")
12
- contract = factory.deploy(args=[INITIAL_STATE], wait_retries=40)
13
-
14
- # Get initial state
15
- contract_state_1 = contract.get_storage(args=[]).call()
16
- assert contract_state_1 == INITIAL_STATE
17
-
18
- # Update State
19
- transaction_response_call_1 = contract.update_storage(
20
- args=[UPDATED_STATE]
21
- ).transact(wait_retries=40)
22
- assert tx_execution_succeeded(transaction_response_call_1)
23
-
24
- # Get Updated State
25
- contract_state_2 = contract.get_storage(args=[]).call()
26
- assert contract_state_2 == UPDATED_STATE
@@ -1,87 +0,0 @@
1
- from gltest import (
2
- get_contract_factory,
3
- get_default_account,
4
- create_account,
5
- get_accounts,
6
- )
7
- from gltest.assertions import tx_execution_succeeded
8
- from gltest_cli.config.general import get_general_config
9
- from genlayer_py.chains import testnet_asimov
10
-
11
-
12
- INITIAL_STATE_USER_A = "user_a_initial_state"
13
- UPDATED_STATE_USER_A = "user_a_updated_state"
14
- INITIAL_STATE_USER_B = "user_b_initial_state"
15
- UPDATED_STATE_USER_B = "user_b_updated_state"
16
-
17
-
18
- def test_user_storage(setup_validators):
19
- setup_validators()
20
- general_config = get_general_config()
21
- chain = general_config.get_chain()
22
-
23
- # Account Setup
24
- if chain.id == testnet_asimov.id:
25
- accounts = get_accounts()
26
- if len(accounts) < 2:
27
- raise ValueError(
28
- f"Test requires at least 2 accounts, but only {len(accounts)} available"
29
- )
30
- from_account_a = accounts[0]
31
- from_account_b = accounts[1]
32
- else:
33
- from_account_a = get_default_account()
34
- from_account_b = create_account()
35
-
36
- factory = get_contract_factory("UserStorage")
37
- contract = factory.deploy()
38
-
39
- # GET Initial State
40
- contract_state_1 = contract.get_complete_storage(args=[]).call()
41
- assert contract_state_1 == {}
42
-
43
- # ADD User A State
44
- transaction_response_call_1 = contract.update_storage(
45
- args=[INITIAL_STATE_USER_A]
46
- ).transact()
47
- assert tx_execution_succeeded(transaction_response_call_1)
48
-
49
- # Get Updated State
50
- contract_state_2_1 = contract.get_complete_storage(args=[]).call()
51
- assert contract_state_2_1[from_account_a.address] == INITIAL_STATE_USER_A
52
-
53
- # Get Updated State
54
- contract_state_2_2 = contract.get_account_storage(
55
- args=[from_account_a.address]
56
- ).call()
57
- assert contract_state_2_2 == INITIAL_STATE_USER_A
58
-
59
- # ADD User B State
60
- transaction_response_call_2 = (
61
- contract.connect(from_account_b)
62
- .update_storage(args=[INITIAL_STATE_USER_B])
63
- .transact()
64
- )
65
- assert tx_execution_succeeded(transaction_response_call_2)
66
-
67
- # Get Updated State
68
- contract_state_3 = contract.get_complete_storage(args=[]).call()
69
- assert contract_state_3[from_account_a.address] == INITIAL_STATE_USER_A
70
- assert contract_state_3[from_account_b.address] == INITIAL_STATE_USER_B
71
-
72
- # UPDATE User A State
73
- transaction_response_call_3 = contract.update_storage(
74
- args=[UPDATED_STATE_USER_A]
75
- ).transact()
76
- assert tx_execution_succeeded(transaction_response_call_3)
77
-
78
- # Get Updated State
79
- contract_state_4_1 = contract.get_complete_storage(args=[]).call()
80
- assert contract_state_4_1[from_account_a.address] == UPDATED_STATE_USER_A
81
- assert contract_state_4_1[from_account_b.address] == INITIAL_STATE_USER_B
82
-
83
- # Get Updated State
84
- contract_state_4_2 = contract.get_account_storage(
85
- args=[from_account_b.address]
86
- ).call()
87
- assert contract_state_4_2 == INITIAL_STATE_USER_B
@@ -1,27 +0,0 @@
1
- from gltest import get_contract_factory
2
- from gltest.assertions import tx_execution_succeeded
3
- import json
4
-
5
-
6
- def test_wizard_of_coin(setup_validators):
7
- mock_response = {
8
- "response": {
9
- "wizard": json.dumps(
10
- {
11
- "reasoning": "I am a grumpy wizard and I never give away my coins!",
12
- "give_coin": False,
13
- }
14
- ),
15
- },
16
- "eq_principle_prompt_comparative": {
17
- "The value of give_coin has to match": True
18
- },
19
- }
20
- setup_validators(mock_response)
21
- factory = get_contract_factory("WizardOfCoin")
22
- contract = factory.deploy(args=[True])
23
-
24
- transaction_response_call_1 = contract.ask_for_coin(
25
- args=["Can you please give me my coin?"]
26
- ).transact()
27
- assert tx_execution_succeeded(transaction_response_call_1)
tests/gltest/__init__.py DELETED
File without changes
File without changes
@@ -1,22 +0,0 @@
1
- # { "Depends": "py-genlayer:test" }
2
-
3
- from genlayer import *
4
-
5
-
6
- # contract class
7
- class DuplicateContract(gl.Contract):
8
- storage: str
9
-
10
- # constructor
11
- def __init__(self, initial_storage: str):
12
- self.storage = initial_storage
13
-
14
- # read methods must be annotated with view
15
- @gl.public.view
16
- def get_storage(self) -> str:
17
- return self.storage
18
-
19
- # write method
20
- @gl.public.write
21
- def update_storage(self, new_storage: str) -> None:
22
- self.storage = new_storage
@@ -1,22 +0,0 @@
1
- # { "Depends": "py-genlayer:test" }
2
-
3
- from genlayer import *
4
-
5
-
6
- # contract class
7
- class DuplicateContract(gl.Contract):
8
- storage: str
9
-
10
- # constructor
11
- def __init__(self, initial_storage: str):
12
- self.storage = initial_storage
13
-
14
- # read methods must be annotated with view
15
- @gl.public.view
16
- def get_storage(self) -> str:
17
- return self.storage
18
-
19
- # write method
20
- @gl.public.write
21
- def update_storage(self, new_storage: str) -> None:
22
- self.storage = new_storage
@@ -1,22 +0,0 @@
1
- # { "Depends": "py-genlayer:test" }
2
-
3
- from genlayer import *
4
-
5
-
6
- # contract class that is not an IC contract
7
- class NotICContract:
8
- storage: str
9
-
10
- # constructor
11
- def __init__(self, initial_storage: str):
12
- self.storage = initial_storage
13
-
14
- # read methods must be annotated with view
15
- @gl.public.view
16
- def get_storage(self) -> str:
17
- return self.storage
18
-
19
- # write method
20
- @gl.public.write
21
- def update_storage(self, new_storage: str) -> None:
22
- self.storage = new_storage
@@ -1,55 +0,0 @@
1
- import pytest
2
- from gltest.artifacts.contract import (
3
- find_contract_definition_from_name,
4
- compute_contract_code,
5
- )
6
- from gltest_cli.config.general import get_general_config
7
- from pathlib import Path
8
-
9
- CONTRACTS_DIR = Path("tests/examples/contracts")
10
-
11
-
12
- def test_single_file():
13
- general_config = get_general_config()
14
- general_config.set_contracts_dir(Path("."))
15
- contract_definition = find_contract_definition_from_name("PredictionMarket")
16
-
17
- assert contract_definition.contract_name == "PredictionMarket"
18
-
19
- # Assert complete contract definition
20
- expected_main_file_path = CONTRACTS_DIR / "football_prediction_market.py"
21
- expected_runner_file_path = None
22
- contract_code = compute_contract_code(
23
- expected_main_file_path, expected_runner_file_path
24
- )
25
- assert contract_definition.contract_code == contract_code
26
- assert str(contract_definition.main_file_path) == str(
27
- CONTRACTS_DIR / "football_prediction_market.py"
28
- )
29
- assert contract_definition.runner_file_path is None
30
-
31
-
32
- def test_multiple_files():
33
- general_config = get_general_config()
34
- general_config.set_contracts_dir(Path("."))
35
- contract_definition = find_contract_definition_from_name("MultiFileContract")
36
-
37
- assert contract_definition.contract_name == "MultiFileContract"
38
-
39
- # Assert complete contract definition
40
- expected_main_file_path = CONTRACTS_DIR / "multi_file_contract/__init__.py"
41
- expected_runner_file_path = CONTRACTS_DIR / "multi_file_contract/runner.json"
42
- assert contract_definition.main_file_path == expected_main_file_path
43
- assert contract_definition.runner_file_path == expected_runner_file_path
44
- contract_code = compute_contract_code(
45
- expected_main_file_path, expected_runner_file_path
46
- )
47
- assert contract_definition.contract_code == contract_code
48
-
49
-
50
- def test_class_is_not_intelligent_contract():
51
- general_config = get_general_config()
52
- general_config.set_contracts_dir(Path("."))
53
-
54
- with pytest.raises(FileNotFoundError):
55
- _ = find_contract_definition_from_name("NotICContract")