Takosaga commited on
Commit
80aa142
Β·
1 Parent(s): 74f118e

fix: remove mock cards in app.py

Browse files
Files changed (2) hide show
  1. app.py +0 -52
  2. tests/app_test.py +0 -39
app.py CHANGED
@@ -117,58 +117,6 @@ _phase1_texts: list[str] = [] # English texts from Phase 1, passed to Phase 2
117
  _current_cards: list[dict] = [] # Full card data after Phase 2 (with media paths)
118
 
119
 
120
- # ─── Mock Card Data ────────────────────────────────────────────────
121
-
122
- MOCK_CARDS = {
123
- "A0": [
124
- {"front": "Es esmu bΔ“rns.", "back": "I am a child."},
125
- {"front": "Šī ir māja.", "back": "This is a house."},
126
- {"front": "Es mΔ«lu savu Δ£imeni.", "back": "I love my family."},
127
- ],
128
- "A1": [
129
- {"front": "LabrΔ«t!", "back": "Good morning!"},
130
- {"front": "Paldies.", "back": "Thank you."},
131
- {"front": "Vai tu runā angļu valodu?", "back": "Do you speak English?"},
132
- ],
133
- "A2": [
134
- {"front": "Es strādāju skolā.", "back": "I work at a school."},
135
- {"front": "Kas ir laika grāmata?", "back": "What is a calendar?"},
136
- {"front": "Es eju uz veikalu.", "back": "I am going to the store."},
137
- ],
138
- "B1": [
139
- {"front": "Es gribΔ“tu izdzert kafiju.", "back": "I would like to drink coffee."},
140
- {"front": "Vai jΕ«s varat man palΔ«dzΔ“t?", "back": "Can you help me?"},
141
- {"front": "Cik daudz maksā őis?", "back": "How much does this cost?"},
142
- ],
143
- "B2": [
144
- {"front": "Es uzskatu, ka tas ir pareizi.", "back": "I believe that is correct."},
145
- {"front": "Vai jΕ«s varat izskaidrot iemeslu?", "back": "Can you explain the reason?"},
146
- {"front": "Šis projekts prasa vairāk laika.", "back": "This project requires more time."},
147
- ],
148
- "C1": [
149
- {"front": "Es nevaru atturΔ“ties no domas, ka...", "back": "I can't help but think that..."},
150
- {"front": "Tas ir acīmredzami, taču...", "back": "It is obvious, however..."},
151
- {"front": "Vai jūs dalāties manā viedoklī?", "back": "Do you share my opinion?"},
152
- ],
153
- "C2": [
154
- {"front": "Es apgΕ«stu latvieΕ‘u valodu ar lielu aizrautΔ«bu.", "back": "I am mastering the Latvian language with great enthusiasm."},
155
- {"front": "Šis ir sarežģīts jautājums.", "back": "This is a complex question."},
156
- {"front": "Es saprotu katru vārdu.", "back": "I understand every word."},
157
- ],
158
- }
159
-
160
-
161
- def transform_mock_cards(raw_cards: list[dict]) -> list[dict]:
162
- """Transform legacy mock card format to two-phase format.
163
-
164
- Legacy format: {"front": <Latvian>, "back": <English>}
165
- New format: {"text": <English>, "translation": <Latvian>}
166
-
167
- For text-only phase, 'text' is displayed with placeholder back.
168
- After media generation, 'translation' is populated.
169
- """
170
- return [{"text": c["back"], "translation": c["front"]} for c in raw_cards]
171
-
172
 
173
  def generate_text_async(
174
  scenario: str,
 
117
  _current_cards: list[dict] = [] # Full card data after Phase 2 (with media paths)
118
 
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  def generate_text_async(
122
  scenario: str,
tests/app_test.py CHANGED
@@ -8,45 +8,6 @@ from unittest.mock import patch, MagicMock
8
  PROJECT_ROOT = Path(__file__).resolve().parent.parent
9
 
10
 
11
- # ── transform_mock_cards ─────────────────────────────────────────
12
-
13
- def test_transform_mock_cards_legacy_to_new_format():
14
- """Legacy {"front": X, "back": Y} β†’ new {"text": Y, "translation": X}."""
15
- from app import transform_mock_cards
16
-
17
- raw = [
18
- {"front": "Sveiki", "back": "Hello"},
19
- {"front": "Paldies", "back": "Thank you"},
20
- ]
21
- result = transform_mock_cards(raw)
22
- assert result[0]["text"] == "Hello"
23
- assert result[0]["translation"] == "Sveiki"
24
- assert result[1]["text"] == "Thank you"
25
- assert result[1]["translation"] == "Paldies"
26
-
27
-
28
- def test_transform_mock_cards_empty_input():
29
- """Empty input returns empty list."""
30
- from app import transform_mock_cards
31
-
32
- assert transform_mock_cards([]) == []
33
-
34
-
35
- def test_transform_mock_cards_preserves_order():
36
- """Multiple cards preserved in order."""
37
- from app import transform_mock_cards
38
-
39
- raw = [
40
- {"front": "A1", "back": "B1"},
41
- {"front": "A2", "back": "B2"},
42
- {"front": "A3", "back": "B3"},
43
- ]
44
- result = transform_mock_cards(raw)
45
- assert len(result) == 3
46
- assert result[0]["text"] == "B1"
47
- assert result[1]["text"] == "B2"
48
- assert result[2]["text"] == "B3"
49
-
50
 
51
  # ── _progress_pct ────────────────────────────────────────────────
52
 
 
8
  PROJECT_ROOT = Path(__file__).resolve().parent.parent
9
 
10
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  # ── _progress_pct ────────────────────────────────────────────────
13