|
| 1 | +from pytest import MonkeyPatch |
| 2 | +from BCSFE_Python.edits.cats import cat_id_selector |
| 3 | + |
| 4 | + |
| 5 | +def test_get_all_cats(): |
| 6 | + """Test that the ids are correct""" |
| 7 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 8 | + ids = cat_id_selector.get_all_cats(save_stats) |
| 9 | + assert ids == [0, 1, 2, 3, 4] |
| 10 | + |
| 11 | + |
| 12 | +def test_select_range(monkeypatch: MonkeyPatch): |
| 13 | + """Test that the ids are correct""" |
| 14 | + |
| 15 | + inputs = ["1-5"] |
| 16 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 17 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 18 | + |
| 19 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 20 | + actual_ids = [1, 2, 3, 4, 5] |
| 21 | + assert ids == actual_ids |
| 22 | + |
| 23 | +def test_select_current(): |
| 24 | + """Test that the ids are correct""" |
| 25 | + |
| 26 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 27 | + |
| 28 | + ids = cat_id_selector.select_current_cats(save_stats) |
| 29 | + actual_ids = [0, 1, 2, 4] |
| 30 | + assert ids == actual_ids |
| 31 | + |
| 32 | +def test_select_rarity(monkeypatch: MonkeyPatch): |
| 33 | + """Test that the ids are correct""" |
| 34 | + |
| 35 | + inputs = ["1"] |
| 36 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 37 | + |
| 38 | + ids = cat_id_selector.select_cats_rarity(False) |
| 39 | + actual_ids = [0, 1, 2, 3, 4, 5, 6, 7, 8, 643] |
| 40 | + assert ids == actual_ids |
| 41 | + |
| 42 | +def test_select_range_reverse(monkeypatch: MonkeyPatch): |
| 43 | + """Test that the ids are correct""" |
| 44 | + |
| 45 | + inputs = ["5-1"] |
| 46 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 47 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 48 | + |
| 49 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 50 | + actual_ids = [1, 2, 3, 4, 5] |
| 51 | + assert ids == actual_ids |
| 52 | + |
| 53 | +def test_select_range_mult(monkeypatch: MonkeyPatch): |
| 54 | + """Test that the ids are correct""" |
| 55 | + |
| 56 | + inputs = ["1-5 7-10"] |
| 57 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 58 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 59 | + |
| 60 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 61 | + actual_ids = [1, 2, 3, 4, 5, 7, 8, 9, 10] |
| 62 | + assert ids == actual_ids |
| 63 | + |
| 64 | +def test_select_range_spaces(monkeypatch: MonkeyPatch): |
| 65 | + """Test that the ids are correct""" |
| 66 | + |
| 67 | + inputs = ["1 4 7 2"] |
| 68 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 69 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 70 | + |
| 71 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 72 | + actual_ids = [1, 4, 7, 2] |
| 73 | + assert ids == actual_ids |
| 74 | + |
| 75 | +def test_select_range_comb(monkeypatch: MonkeyPatch): |
| 76 | + """Test that the ids are correct""" |
| 77 | + |
| 78 | + inputs = ["1 4 7 2 8-10"] |
| 79 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 80 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 81 | + |
| 82 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 83 | + actual_ids = [1, 4, 7, 2, 8, 9, 10] |
| 84 | + assert ids == actual_ids |
| 85 | + |
| 86 | +def test_select_range_all(monkeypatch: MonkeyPatch): |
| 87 | + """Test that the ids are correct""" |
| 88 | + |
| 89 | + inputs = ["all"] |
| 90 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 91 | + save_stats = {"cats": [1, 1, 1, 0, 1]} |
| 92 | + |
| 93 | + ids = cat_id_selector.select_cats_range(save_stats) |
| 94 | + actual_ids = [0, 1, 2, 3, 4] |
| 95 | + assert ids == actual_ids |
| 96 | + |
| 97 | + |
| 98 | +def test_gatya_banner(monkeypatch: MonkeyPatch): |
| 99 | + """Test that the ids are correct""" |
| 100 | + |
| 101 | + inputs = ["602"] |
| 102 | + monkeypatch.setattr("builtins.input", lambda: inputs.pop(0)) |
| 103 | + |
| 104 | + ids = cat_id_selector.select_cats_gatya_banner(False) |
| 105 | + ids.sort() |
| 106 | + actual_ids = [ |
| 107 | + 448, |
| 108 | + 449, |
| 109 | + 450, |
| 110 | + 451, |
| 111 | + 455, |
| 112 | + 461, |
| 113 | + 463, |
| 114 | + 478, |
| 115 | + 481, |
| 116 | + 493, |
| 117 | + 544, |
| 118 | + 612, |
| 119 | + 138, |
| 120 | + 259, |
| 121 | + 330, |
| 122 | + 195, |
| 123 | + 496, |
| 124 | + 358, |
| 125 | + 376, |
| 126 | + 502, |
| 127 | + 526, |
| 128 | + 533, |
| 129 | + 564, |
| 130 | + 229, |
| 131 | + 30, |
| 132 | + 31, |
| 133 | + 32, |
| 134 | + 33, |
| 135 | + 35, |
| 136 | + 36, |
| 137 | + 39, |
| 138 | + 40, |
| 139 | + 61, |
| 140 | + 150, |
| 141 | + 151, |
| 142 | + 152, |
| 143 | + 153, |
| 144 | + 199, |
| 145 | + 307, |
| 146 | + 377, |
| 147 | + 522, |
| 148 | + 37, |
| 149 | + 38, |
| 150 | + 41, |
| 151 | + 42, |
| 152 | + 46, |
| 153 | + 47, |
| 154 | + 48, |
| 155 | + 49, |
| 156 | + 50, |
| 157 | + 51, |
| 158 | + 52, |
| 159 | + 55, |
| 160 | + 56, |
| 161 | + 58, |
| 162 | + 106, |
| 163 | + 145, |
| 164 | + 146, |
| 165 | + 147, |
| 166 | + 148, |
| 167 | + 149, |
| 168 | + 197, |
| 169 | + 198, |
| 170 | + 308, |
| 171 | + 325, |
| 172 | + 495, |
| 173 | + 271, |
| 174 | + 523, |
| 175 | + ] |
| 176 | + actual_ids.sort() |
| 177 | + assert ids == actual_ids |
0 commit comments