-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
incubate using infinite first, then breakable
- Loading branch information
Showing
3 changed files
with
94 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import unittest | ||
from mock import patch | ||
from pokemongo_bot.cell_workers.incubate_eggs import IncubateEggs | ||
|
||
|
||
class IncubateEggsTestCase(unittest.TestCase): | ||
|
||
@patch('pokemongo_bot.PokemonGoBot') | ||
def testFilterAndSort_AllowNone(self, mock_pokemongo_bot): | ||
incubate_eggs = IncubateEggs(mock_pokemongo_bot, {}) | ||
|
||
incubate_eggs.eggs = [{"km": 2.0}, {"km": 5.0}, {"km": 5.0}] | ||
|
||
allowed = [] | ||
sorting = True | ||
|
||
result = incubate_eggs._filter_sort_eggs(allowed, sorting) | ||
self.assertEqual([], result) | ||
|
||
|
||
@patch('pokemongo_bot.PokemonGoBot') | ||
def testFilterAndSort_AllowSome(self, mock_pokemongo_bot): | ||
incubate_eggs = IncubateEggs(mock_pokemongo_bot, {}) | ||
|
||
incubate_eggs.eggs = [{"km": 5.0}, {"km": 2.0}, {"km": 5.0}, {"km": 10.0}] | ||
|
||
allowed = [2, 10] | ||
sorting = True | ||
|
||
result = incubate_eggs._filter_sort_eggs(allowed, sorting) | ||
self.assertEqual([{"km": 10.0}, {"km": 2.0}], result) | ||
|
||
|
||
@patch('pokemongo_bot.PokemonGoBot') | ||
def testFilterAndSort_AllowSomeNoReverseSort(self, mock_pokemongo_bot): | ||
incubate_eggs = IncubateEggs(mock_pokemongo_bot, {}) | ||
|
||
incubate_eggs.eggs = [{"km": 5.0}, {"km": 2.0}, {"km": 5.0}, {"km": 10.0}] | ||
|
||
allowed = [2, 10] | ||
sorting = False | ||
|
||
result = incubate_eggs._filter_sort_eggs(allowed, sorting) | ||
self.assertEqual([{"km": 2.0}, {"km": 10.0}], result) | ||
|
||
|
||
|
||
@patch('pokemongo_bot.PokemonGoBot') | ||
def testFilterAndSort_AllowAll(self, mock_pokemongo_bot): | ||
incubate_eggs = IncubateEggs(mock_pokemongo_bot, {}) | ||
|
||
incubate_eggs.eggs = [{"km": 5.0}, {"km": 2.0}, {"km": 5.0}] | ||
|
||
allowed = [2, 5, 10] | ||
sorting = True | ||
|
||
result = incubate_eggs._filter_sort_eggs(allowed, sorting) | ||
self.assertEqual([{"km": 5.0}, {"km": 5.0}, {"km": 2.0}], result) |
Submodule web
updated
from 607397 to 6ba560