-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ru Chern Chong
committed
May 7, 2024
1 parent
533b72a
commit bea8f2d
Showing
2 changed files
with
56 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
certifi==2024.2.2 | ||
charset-normalizer==3.3.2 | ||
coverage==7.5.1 | ||
dnspython==2.6.1 | ||
idna==3.7 | ||
iniconfig==2.0.0 | ||
mypy==1.10.0 | ||
mypy-extensions==1.0.0 | ||
packaging==24.0 | ||
pluggy==1.5.0 | ||
pymongo==4.7.1 | ||
pytest==8.2.0 | ||
requests==2.31.0 | ||
Transcrypt==3.9.1 | ||
typing_extensions==4.11.0 | ||
urllib3==2.2.1 |
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,47 @@ | ||
import pytest | ||
from utils.create_unique_key import create_unique_key | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"item, key_fields, expected_result", | ||
[ | ||
( | ||
{ | ||
"_id": {"$oid": "6635f923c113f9ccd1cea039"}, | ||
"fuel_type": "Petrol", | ||
"importer_type": "AMD", | ||
"make": "B.M.W.", | ||
"month": "2024-03", | ||
"number": "54", | ||
"vehicle_type": "Sedan", | ||
}, | ||
["month"], | ||
"2024-03", | ||
), | ||
], | ||
) | ||
def test_generate_unique_key_for_cars(item, key_fields, expected_result): | ||
assert create_unique_key(item, key_fields) == expected_result | ||
|
||
|
||
def test_generate_unique_key_for_coe(): | ||
assert ( | ||
create_unique_key( | ||
{ | ||
"_id": {"$oid": "663a4e0a3d609a019b87090e"}, | ||
"bidding_no": "2", | ||
"bids_received": "1,008", | ||
"bids_success": "690", | ||
"month": "2024-04", | ||
"premium": "102001", | ||
"quota": "690", | ||
"vehicle_class": "Category B", | ||
}, | ||
["month", "bidding_no"], | ||
) | ||
== "2024-04-2" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
pytest.main() |