-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get account accepts bytes, address or hex
- Loading branch information
1 parent
467bf87
commit 690f0b2
Showing
5 changed files
with
101 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from unittest import TestCase | ||
|
||
from flow_py_sdk.cadence import Address | ||
from flow_py_sdk.exceptions import NotAddressError | ||
|
||
|
||
class TestAddress(TestCase): | ||
def test_convert_to_bytes(self): | ||
with self.subTest(msg="Pass address as bytes"): | ||
address = Address.from_hex("0x01") | ||
self.assertEqual(address.bytes, Address.convert_to_bytes(address.bytes)) | ||
|
||
with self.subTest(msg="Pass address as Address"): | ||
address = Address.from_hex("0x01") | ||
self.assertEqual(address.bytes, Address.convert_to_bytes(address)) | ||
|
||
with self.subTest(msg="Pass address as hex string"): | ||
address = Address.from_hex("0x01") | ||
self.assertEqual(address.bytes, Address.convert_to_bytes(address.hex())) | ||
|
||
with self.subTest(msg="Pass address as unknown"): | ||
with self.assertRaises(NotAddressError): | ||
Address.convert_to_bytes(1) |