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

#86drpnca2 - Compilation error when trying to attribute an operation directly into the value of a dictionary #1246

Merged
merged 1 commit into from
May 3, 2024

Conversation

meevee98
Copy link
Collaborator

@meevee98 meevee98 commented May 2, 2024

Summary or solution description
Couldn't reproduce the bug, I think it was fixed in other issues. Included in the unit tests to make sure it works properly.

How to Reproduce

def symbol() -> str:
return "test"
def get_id() -> str:
return StdLib.itoa(runtime.get_random())
@public
def Main() -> Any:
token_id = get_id()
first_token = {"id": token_id, "name": (symbol() + token_id)}
return first_token

Tests

async def test_dict_value_with_method_return(self):
await self.set_up_contract('DictValueWithMethodReturn.py')
symbol, _ = await self.call('symbol', return_type=str)
self.assertGreater(len(symbol), 0)
result, _ = await self.call('Main', [], return_type=dict[str, str], signing_accounts=[self.genesis])
self.assertIn('id', result)
token_id = result['id']
expected = {"id": token_id, "name": (symbol + token_id)}
self.assertEqual(expected, result)
result, _ = await self.call('Main', [], return_type=dict[str, str])
self.assertIn('id', result)
self.assertNotEqual(result['id'], token_id)
token_id = result['id']
expected = {"id": token_id, "name": (symbol + token_id)}
self.assertEqual(expected, result)

@meevee98 meevee98 self-assigned this May 2, 2024
@melanke
Copy link
Collaborator

melanke commented May 2, 2024

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 91.749% (+0.004%) from 91.745%
when pulling 14586f0 on CU-86drpnca2
into c71affa on development.

@luc10921 luc10921 merged commit 44bc501 into development May 3, 2024
5 checks passed
@luc10921 luc10921 deleted the CU-86drpnca2 branch May 3, 2024 18:57
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.

None yet

4 participants