Skip to content

Commit 78a5534

Browse files
committed
Fixed tests for new version
Fixed the test, both a wrong test and a value that changed in an old test
1 parent 0f55aa3 commit 78a5534

File tree

4 files changed

+24
-24
lines changed

4 files changed

+24
-24
lines changed

howlongtobeatpy/tests/test_async_request.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ async def test_game_name_with_colon(self):
2828

2929
@async_test
3030
async def test_game_name(self):
31-
results = await HowLongToBeat().async_search("A way out")
31+
results = await HowLongToBeat().async_search("Crysis Warhead")
3232
self.assertNotEqual(None, results, "Search Results are None")
3333
best_result = TestNormalRequest.getMaxSimilarityElement(results)
34-
self.assertEqual("A Way Out", best_result.game_name)
34+
self.assertEqual("Crysis Warhead", best_result.game_name)
3535
self.assertEqual("Main Story", best_result.gameplay_main_label)
3636
self.assertEqual("Main + Extra", best_result.gameplay_main_extra_label)
3737
self.assertEqual("Completionist", best_result.gameplay_completionist_label)
@@ -56,13 +56,13 @@ async def test_game_with_no_all_values(self):
5656
self.assertEqual("Battlefield 2142", best_result.game_name)
5757
self.assertEqual(None, best_result.gameplay_main_label)
5858
self.assertEqual("Co-Op", best_result.gameplay_main_extra_label)
59+
self.assertEqual("Hours", best_result.gameplay_main_extra_unit)
60+
self.assertAlmostEqual(17, TestNormalRequest.getSimpleNumber(best_result.gameplay_main_extra), delta=5)
5961
self.assertEqual("Vs.", best_result.gameplay_completionist_label)
60-
self.assertAlmostEqual(80, TestNormalRequest.getSimpleNumber(best_result.gameplay_completionist), delta=5)
62+
self.assertAlmostEqual(65, TestNormalRequest.getSimpleNumber(best_result.gameplay_completionist), delta=5)
6163
self.assertEqual("Hours", best_result.gameplay_completionist_unit)
6264
self.assertEqual(None, best_result.gameplay_main_unit)
63-
self.assertEqual(None, best_result.gameplay_main_extra_unit)
6465
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(best_result.gameplay_main))
65-
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(best_result.gameplay_main_extra))
6666

6767
@async_test
6868
async def test_game_default_dlc_search(self):
@@ -90,9 +90,9 @@ async def test_game_isolate_dlc_search(self):
9090

9191
@async_test
9292
async def test_game_really_isolate_dlc_search(self):
93-
results = await HowLongToBeat().async_search("The Witcher 3", SearchModifiers.ISOLATE_DLC)
93+
results = await HowLongToBeat(0).async_search("Skyrim", SearchModifiers.ISOLATE_DLC)
9494
self.assertNotEqual(None, results, "Search Results are None")
95-
self.assertEqual(2, len(results))
95+
self.assertEqual(3, len(results))
9696

9797
@async_test
9898
async def test_game_case_sensitive(self):

howlongtobeatpy/tests/test_async_request_by_id.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ async def test_game_name_with_colon(self):
2424

2525
@async_test
2626
async def test_game_name(self):
27-
result = await HowLongToBeat().async_search_from_id(46386)
27+
result = await HowLongToBeat().async_search_from_id(2071)
2828
self.assertNotEqual(None, result, "Search Result is None")
29-
self.assertEqual("A Way Out", result.game_name)
29+
self.assertEqual("Crysis Warhead", result.game_name)
3030
self.assertEqual("Main Story", result.gameplay_main_label)
3131
self.assertEqual("Main + Extra", result.gameplay_main_extra_label)
3232
self.assertEqual("Completionist", result.gameplay_completionist_label)
@@ -49,13 +49,13 @@ async def test_game_with_no_all_values(self):
4949
self.assertEqual("Battlefield 2142", result.game_name)
5050
self.assertEqual(None, result.gameplay_main_label)
5151
self.assertEqual("Co-Op", result.gameplay_main_extra_label)
52+
self.assertEqual("Hours", result.gameplay_main_extra_unit)
53+
self.assertAlmostEqual(17, TestNormalRequest.getSimpleNumber(result.gameplay_main_extra), delta=5)
5254
self.assertEqual("Vs.", result.gameplay_completionist_label)
53-
self.assertAlmostEqual(80, TestNormalRequest.getSimpleNumber(result.gameplay_completionist), delta=5)
55+
self.assertAlmostEqual(65, TestNormalRequest.getSimpleNumber(result.gameplay_completionist), delta=5)
5456
self.assertEqual("Hours", result.gameplay_completionist_unit)
5557
self.assertEqual(None, result.gameplay_main_unit)
56-
self.assertEqual(None, result.gameplay_main_extra_unit)
5758
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(result.gameplay_main))
58-
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(result.gameplay_main_extra))
5959

6060
@async_test
6161
async def test_no_real_game(self):

howlongtobeatpy/tests/test_normal_request.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ def test_game_name_with_colon(self):
4747
self.assertEqual("Half-Life: Opposing Force", best_result.game_name)
4848

4949
def test_game_name(self):
50-
results = HowLongToBeat().search("A way out")
50+
results = HowLongToBeat().search("Crysis Warhead")
5151
self.assertNotEqual(None, results, "Search Results are None")
5252
best_result = self.getMaxSimilarityElement(results)
53-
self.assertEqual("A Way Out", best_result.game_name)
53+
self.assertEqual("Crysis Warhead", best_result.game_name)
5454
self.assertEqual("Main Story", best_result.gameplay_main_label)
5555
self.assertEqual("Main + Extra", best_result.gameplay_main_extra_label)
5656
self.assertEqual("Completionist", best_result.gameplay_completionist_label)
@@ -73,13 +73,13 @@ def test_game_with_no_all_values(self):
7373
self.assertEqual("Battlefield 2142", best_result.game_name)
7474
self.assertEqual(None, best_result.gameplay_main_label)
7575
self.assertEqual("Co-Op", best_result.gameplay_main_extra_label)
76+
self.assertEqual("Hours", best_result.gameplay_main_extra_unit)
77+
self.assertAlmostEqual(17, TestNormalRequest.getSimpleNumber(best_result.gameplay_main_extra), delta=5)
7678
self.assertEqual("Vs.", best_result.gameplay_completionist_label)
77-
self.assertAlmostEqual(80, TestNormalRequest.getSimpleNumber(best_result.gameplay_completionist), delta=5)
79+
self.assertAlmostEqual(65, TestNormalRequest.getSimpleNumber(best_result.gameplay_completionist), delta=5)
7880
self.assertEqual("Hours", best_result.gameplay_completionist_unit)
7981
self.assertEqual(None, best_result.gameplay_main_unit)
80-
self.assertEqual(None, best_result.gameplay_main_extra_unit)
8182
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(best_result.gameplay_main))
82-
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(best_result.gameplay_main_extra))
8383

8484
def test_game_default_dlc_search(self):
8585
results = HowLongToBeat().search("Hearts of Stone")
@@ -102,9 +102,9 @@ def test_game_isolate_dlc_search(self):
102102
self.assertEqual("The Witcher 3: Wild Hunt - Hearts of Stone", best_result.game_name)
103103

104104
def test_game_really_isolate_dlc_search(self):
105-
results = HowLongToBeat().search("The Witcher 3", SearchModifiers.ISOLATE_DLC)
105+
results = HowLongToBeat(0).search("Skyrim", SearchModifiers.ISOLATE_DLC)
106106
self.assertNotEqual(None, results, "Search Results are None")
107-
self.assertEqual(2, len(results))
107+
self.assertEqual(3, len(results))
108108

109109
def test_game_case_sensitive(self):
110110
results_standard = HowLongToBeat(0).search("RED HOT VENGEANCE")

howlongtobeatpy/tests/test_normal_request_by_id.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def test_game_name_with_colon(self):
2020
self.assertEqual("Half-Life: Opposing Force", result.game_name)
2121

2222
def test_game_name(self):
23-
result = HowLongToBeat().search_from_id(46386)
23+
result = HowLongToBeat().search_from_id(2071)
2424
self.assertNotEqual(None, result, "Search Result is None")
25-
self.assertEqual("A Way Out", result.game_name)
25+
self.assertEqual("Crysis Warhead", result.game_name)
2626
self.assertEqual("Main Story", result.gameplay_main_label)
2727
self.assertEqual("Main + Extra", result.gameplay_main_extra_label)
2828
self.assertEqual("Completionist", result.gameplay_completionist_label)
@@ -43,13 +43,13 @@ def test_game_with_no_all_values(self):
4343
self.assertEqual("Battlefield 2142", result.game_name)
4444
self.assertEqual(None, result.gameplay_main_label)
4545
self.assertEqual("Co-Op", result.gameplay_main_extra_label)
46+
self.assertEqual("Hours", result.gameplay_main_extra_unit)
47+
self.assertAlmostEqual(17, TestNormalRequest.getSimpleNumber(result.gameplay_main_extra), delta=5)
4648
self.assertEqual("Vs.", result.gameplay_completionist_label)
47-
self.assertAlmostEqual(80, TestNormalRequest.getSimpleNumber(result.gameplay_completionist), delta=5)
49+
self.assertAlmostEqual(65, TestNormalRequest.getSimpleNumber(result.gameplay_completionist), delta=5)
4850
self.assertEqual("Hours", result.gameplay_completionist_unit)
4951
self.assertEqual(None, result.gameplay_main_unit)
50-
self.assertEqual(None, result.gameplay_main_extra_unit)
5152
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(result.gameplay_main))
52-
self.assertEqual(-1, TestNormalRequest.getSimpleNumber(result.gameplay_main_extra))
5353

5454
def test_no_real_game(self):
5555
result = HowLongToBeat().search_from_id(123)

0 commit comments

Comments
 (0)