forked from hummingbot/hummingbot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hummingbot#6832 from yancong001/feat/hyperliquid_v…
…ault Feat/hyperliquid vault
- Loading branch information
Showing
8 changed files
with
136 additions
and
22 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
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
48 changes: 48 additions & 0 deletions
48
...hummingbot/connector/derivative/hyperliquid_perpetual/test_hyperliquid_perpetual_utils.py
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 |
---|---|---|
@@ -1,5 +1,53 @@ | ||
from unittest import TestCase | ||
|
||
from hummingbot.connector.derivative.hyperliquid_perpetual.hyperliquid_perpetual_utils import ( | ||
HyperliquidPerpetualConfigMap, | ||
HyperliquidPerpetualTestnetConfigMap, | ||
validate_bool, | ||
) | ||
|
||
|
||
class HyperliquidPerpetualUtilsTests(TestCase): | ||
pass | ||
|
||
def test_validate_bool_succeed(self): | ||
valid_values = ['true', 'yes', 'y', 'false', 'no', 'n'] | ||
|
||
validations = [validate_bool(value) for value in valid_values] | ||
for validation in validations: | ||
self.assertIsNone(validation) | ||
|
||
def test_validate_bool_fails(self): | ||
wrong_value = "ye" | ||
valid_values = ('true', 'yes', 'y', 'false', 'no', 'n') | ||
|
||
validation_error = validate_bool(wrong_value) | ||
self.assertEqual(validation_error, f"Invalid value, please choose value from {valid_values}") | ||
|
||
def test_cls_validate_bool_succeed(self): | ||
valid_values = ['true', 'yes', 'y', 'false', 'no', 'n'] | ||
|
||
validations = [HyperliquidPerpetualConfigMap.validate_bool(value) for value in valid_values] | ||
for validation in validations: | ||
self.assertTrue(validation) | ||
|
||
def test_cls_validate_bool_fails(self): | ||
wrong_value = "ye" | ||
valid_values = ('true', 'yes', 'y', 'false', 'no', 'n') | ||
with self.assertRaises(ValueError) as exception_context: | ||
HyperliquidPerpetualConfigMap.validate_bool(wrong_value) | ||
self.assertEqual(str(exception_context.exception), f"Invalid value, please choose value from {valid_values}") | ||
|
||
def test_cls_testnet_validate_bool_succeed(self): | ||
valid_values = ['true', 'yes', 'y', 'false', 'no', 'n'] | ||
|
||
validations = [HyperliquidPerpetualTestnetConfigMap.validate_bool(value) for value in valid_values] | ||
for validation in validations: | ||
self.assertTrue(validation) | ||
|
||
def test_cls_testnet_validate_bool_fails(self): | ||
wrong_value = "ye" | ||
valid_values = ('true', 'yes', 'y', 'false', 'no', 'n') | ||
with self.assertRaises(ValueError) as exception_context: | ||
HyperliquidPerpetualTestnetConfigMap.validate_bool(wrong_value) | ||
self.assertEqual(str(exception_context.exception), f"Invalid value, please choose value from {valid_values}") |