divan-data/test_ghazal_marks.py
Anas Rashid b46fdb5ca9
Some checks are pending
Wikisource sync / sync (push) Waiting to run
Ghazal marks: radif, matla, maqta (takhallus sign) and radif letter for divan contents
Grouping and order now read the radif from the first couplet's second line, which carries it
even when the source lacks the matla.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 21:27:22 +02:00

18 lines
733 B
Python

# python3 test_ghazal_marks.py
from export_divan import ghazal_marks, verses
g = """دل ناداں تجھے ہوا کیا ہے
آخر اس درد کی دوا کیا ہے
ہم ہیں مشتاق اور وہ بے زار
یا الٰہی یہ ماجرا کیا ہے
میں نے مانا کہ کچھ نہیں غالبؔ
مفت ہاتھ آئے تو برا کیا ہے"""
assert ghazal_marks(verses(g, False)[0]) == {"Maqta": 2, "Radif": "کیا ہے", "Matla": 0}
# first couplet does not rhyme (matla missing): no radif/matla, maqta still found
no_matla = g.replace("آخر اس درد کی دوا کیا ہے", "آخر اس درد کی دوا کیا ہم")
assert ghazal_marks(verses(no_matla, False)[0]) == {"Maqta": 2}
print("ok")