refactor: extract apply_applet_toggle, rooms_for_user & natus helpers to utils; DRY toggle views
- epic/utils.py (new): _planet_house, _compute_distinctions, rooms_for_user - applets/utils.py: apply_applet_toggle replaces 5 copy-pasted toggle loops - dashboard/views.py: use apply_applet_toggle; fix double free_tokens/tithe_tokens query in wallet(); promote _compute_distinctions import to module level - gameboard/views.py: use apply_applet_toggle & rooms_for_user; fix double free_tokens query in toggle_game_applets - billboard/views.py: use apply_applet_toggle & rooms_for_user - SCSS: %tt-token-fields placeholder in _tooltips.scss; _gameboard & _game-kit @extend it - epic/tests/unit/test_utils.py (new): coverage for _planet_house fallback path Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
13
src/apps/epic/tests/unit/test_utils.py
Normal file
13
src/apps/epic/tests/unit/test_utils.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from django.test import SimpleTestCase
|
||||
|
||||
from apps.epic.utils import _planet_house
|
||||
|
||||
|
||||
class PlanetHouseFallbackTest(SimpleTestCase):
|
||||
def test_returns_1_when_no_cusp_matches(self):
|
||||
# Pathological cusps list: all 12 cusps identical (zero-width arcs).
|
||||
# No range has start < end, and the wrap-around condition is also
|
||||
# never satisfied, so the loop exhausts without returning — hitting
|
||||
# the fallback `return 1`.
|
||||
cusps = [0.0] * 12
|
||||
self.assertEqual(_planet_house(180.0, cusps), 1)
|
||||
Reference in New Issue
Block a user