Skip to content

Commit 9382372

Browse files
committed
fix: Fix Errors After Updates
Signed-off-by: aceppaluni <aceppaluni@gmail.com>
1 parent 539c1aa commit 9382372

2 files changed

Lines changed: 67 additions & 1 deletion

File tree

src/hiero_sdk_python/query/fee_estimate_query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def set_max_attempts(self, attempts: int) -> FeeEstimateQuery:
9999

100100
def set_max_backoff(self, seconds: float) -> FeeEstimateQuery:
101101
"""Set maximum exponential backoff delay."""
102-
if not isinstance(seconds, (int, float)):
102+
if not isinstance(seconds, (int | float)):
103103
raise TypeError("seconds must be a number")
104104

105105
if seconds <= 0:

tests/unit/fee_estimate_query_test.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,69 @@ def test_topic_message_multiple_chunks(mock_post):
263263
assert result.service_fee.base == 20 * 2
264264
assert result.network_fee.subtotal == 1 * 2
265265
assert result.total == 210 * 2
266+
267+
268+
# ---------------------------------------------------------------------
269+
# Configuration / validation coverage
270+
# ---------------------------------------------------------------------
271+
272+
273+
def test_high_volume_throttle_validation():
274+
q = FeeEstimateQuery()
275+
276+
with pytest.raises(TypeError):
277+
q.set_high_volume_throttle("100")
278+
279+
with pytest.raises(ValueError):
280+
q.set_high_volume_throttle(-1)
281+
282+
with pytest.raises(ValueError):
283+
q.set_high_volume_throttle(10001)
284+
285+
# valid case
286+
q.set_high_volume_throttle(5000)
287+
assert q.get_high_volume_throttle() == 5000
288+
289+
290+
def test_max_attempts_validation():
291+
q = FeeEstimateQuery()
292+
293+
with pytest.raises(TypeError):
294+
q.set_max_attempts("3")
295+
296+
with pytest.raises(ValueError):
297+
q.set_max_attempts(0)
298+
299+
# valid case
300+
q.set_max_attempts(2)
301+
assert q._max_attempts == 2
302+
303+
304+
def test_max_backoff_validation():
305+
q = FeeEstimateQuery()
306+
307+
with pytest.raises(TypeError):
308+
q.set_max_backoff("fast")
309+
310+
with pytest.raises(ValueError):
311+
q.set_max_backoff(0)
312+
313+
# valid case
314+
q.set_max_backoff(1.5)
315+
assert q._max_backoff == 1.5
316+
317+
318+
def test_getters_and_defaults():
319+
q = FeeEstimateQuery()
320+
321+
assert q.get_mode() is None
322+
assert q.get_transaction() is None
323+
assert q.get_high_volume_throttle() == 0
324+
325+
326+
def test_setters_are_chainable():
327+
q = FeeEstimateQuery()
328+
329+
result = q.set_max_attempts(2).set_max_backoff(1.0).set_high_volume_throttle(100)
330+
331+
assert result is q

0 commit comments

Comments
 (0)