Skip to content

Commit

Permalink
Fix referenced before assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathangreen committed Sep 22, 2023
1 parent 745b4b5 commit dbd1a88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions api/odl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1244,11 +1244,12 @@ def _detail_for_elementtree_entry(
concurrent_checkouts = subtag(terms[0], "odl:concurrent_checkouts")
expires = subtag(terms[0], "odl:expires")

if concurrent_checkouts is not None:
concurrent_checkouts_int = int(concurrent_checkouts)

if expires is not None:
expires_datetime = to_utc(dateutil.parser.parse(expires))
concurrent_checkouts_int = (
int(concurrent_checkouts) if concurrent_checkouts is not None else None
)
expires_datetime = (
to_utc(dateutil.parser.parse(expires)) if expires is not None else None
)

if not odl_status_link:
parsed_license = None
Expand Down
6 changes: 3 additions & 3 deletions tests/api/test_odl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ def test_release_hold_success(
odl_api_test_fixture.checkout(patron=loan_patron)
odl_api_test_fixture.pool.on_hold_to(odl_api_test_fixture.patron, position=1)

assert True == odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.patron, "pin", odl_api_test_fixture.pool
)
assert 0 == odl_api_test_fixture.pool.licenses_available
Expand All @@ -1253,7 +1253,7 @@ def test_release_hold_success(
odl_api_test_fixture.pool.on_hold_to(odl_api_test_fixture.patron, position=0)
odl_api_test_fixture.checkin(patron=loan_patron)

assert True == odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.patron, "pin", odl_api_test_fixture.pool
)
assert 1 == odl_api_test_fixture.pool.licenses_available
Expand All @@ -1266,7 +1266,7 @@ def test_release_hold_success(
db.patron(), position=2
)

assert True == odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.api.release_hold(
odl_api_test_fixture.patron, "pin", odl_api_test_fixture.pool
)
assert 0 == odl_api_test_fixture.pool.licenses_available
Expand Down

0 comments on commit dbd1a88

Please sign in to comment.