Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/models #317

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Test/models #317

wants to merge 14 commits into from

Conversation

annasambrook
Copy link
Collaborator

Models tests and tests for decision maker _io.loader and redeem_info

Copy link
Collaborator

@Adamantios Adamantios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some copyrights of new files start from 2023.
Also please address the post init related comments.

Comment on lines +91 to +95
assert loader == (
{"entry_point": "entry_point.py", "callable": "dummy_callable"},
"dummy_function()",
"dummy_callable",
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, introduce this as an attribute above, e.g., expected_loader, instead of hardcoding here.

Comment on lines +42 to +43
self.liquidity_info.l0_end = None
self.liquidity_info.l0_end = None
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.liquidity_info.l0_end = None
self.liquidity_info.l0_end = None
self.liquidity_info.l0_end = None

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the BenchmarkingMockData is not tested (it has a simple property).

Comment on lines +63 to +65
question = Question(id=id, data="dummy_data")

question.__post_init__()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The post init is automatically called. I would suggest that you check whether its result is the expected one, i.e., if the given id is a string, check that it is bytes after initialization.

condition = Condition(
id="0x00000000000000001234567890abcdef", outcomeSlotCount=2
)
condition.__post_init__()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment re post init as below.

),
templateId=1,
)
fpmm.__post_init__()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

transactionHash="0x5b6a3f8eaa6c8a5c3b123d456e7890abcdef1234567890abcdef1234567890ab",
)

trade.__post_init__()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +45 to +118
DUMMY_DECISION_MAKER_PARAMS = {
"sample_bets_closing_days": 1,
"trading_strategy": "test",
"use_fallback_strategy": True,
"tools_accuracy_hash": "test",
"bet_threshold": 1,
"blacklisting_duration": 1,
"prompt_template": "@{yes}@{no}@{question}",
"dust_threshold": 1,
"conditional_tokens_address": "0x123",
"realitio_proxy_address": "0x456",
"realitio_address": "0x789",
"event_filtering_batch_size": 1,
"reduce_factor": 1.1,
"minimum_batch_size": 1,
"max_filtering_retries": 1,
"redeeming_batch_size": 1,
"redeem_round_timeout": 1.1,
"slippage": 0.05,
"policy_epsilon": 0.1,
"agent_registry_address": "0xabc",
"irrelevant_tools": [],
"tool_punishment_multiplier": 1,
"contract_timeout": 2.0,
"file_hash_to_strategies_json": [
['{"k1": "key2"}', '{"b1": "b2"}'],
['{"v1": "v2"}', '{"b1": "b2"}'],
],
"strategies_kwargs": [
['{"k1": "key2"}', '{"b1": "b2"}'],
['{"v1": "v2"}', '{"b1": "b2"}'],
],
"use_subgraph_for_redeeming": True,
"use_nevermined": False,
"rpc_sleep_time": 2,
"mech_to_subscription_params": [
['{"k1": "key2"}', '{"b1": "b2"}'],
['{"v1": "v2"}', '{"b1": "b2"}'],
],
"service_endpoint": "http://example.com",
"store_path": str(PACKAGE_DIR),
}

DUMMY_MECH_INTERACT_PARAMS = {
"multisend_address": "0x1234567890abcdef1234567890abcdef12345678",
"multisend_batch_size": 100,
"mech_contract_address": "0xabcdef1234567890abcdef1234567890abcdef12",
"mech_request_price": 10,
"ipfs_address": "https://ipfs.example.com",
"mech_chain_id": "gnosis",
"mech_wrapped_native_token_address": "0x9876543210abcdef9876543210abcdef98765432",
"mech_interaction_sleep_time": 5,
}

DUMMY_TERMINATION_PARAMS = {"termination_sleep": 1, "termination_from_block": 1}

DUMMY_TRANSACTION_PARAMS = {
"init_fallback_gas": 1,
"keeper_allowed_retries": 1,
"validate_timeout": 300,
"finalize_timeout": 1.1,
"history_check_timeout": 1,
}

DUMMY_CHECK_STOP_TRADING_PARAMS = {
"disable_trading": True,
"stop_trading_if_staking_kpi_met": True,
}

DUMMY_STAKING_PARAMS = {
"staking_contract_address": "test",
"staking_interaction_sleep_time": 1,
"mech_activity_checker_contract": "test",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be better as fixtures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants