@@ -87,6 +87,37 @@ def make_testset_samples():
8787 ]
8888
8989
90+ def make_swedish_testset_samples ():
91+ return [
92+ QuestionSample (
93+ id = "1" ,
94+ question = "Vilken mjölk används för att göra Camembert?" ,
95+ reference_answer = "Komjölk används för att göra Camembert." ,
96+ reference_context = "Camembert är en fuktig, mjuk, krämig, ytmognad ost av komjölk." ,
97+ conversation_history = [],
98+ metadata = {
99+ "question_type" : "enkel" ,
100+ "color" : "blå" ,
101+ "topic" : "Ost_1" ,
102+ "seed_document_id" : "1" ,
103+ },
104+ ),
105+ QuestionSample (
106+ id = "2" ,
107+ question = "Varifrån kommer Scamorza?" ,
108+ reference_answer = "Scamorza kommer från södra Italien." ,
109+ reference_context = "Scamorza är en ost av komjölk från södra Italien." ,
110+ conversation_history = [],
111+ metadata = {
112+ "question_type" : "enkel" ,
113+ "color" : "röd" ,
114+ "topic" : "Ost_1" ,
115+ "seed_document_id" : "2" ,
116+ },
117+ ),
118+ ]
119+
120+
90121def test_qa_testset_creation ():
91122 question_samples = make_testset_samples ()
92123 testset = QATestset (question_samples )
@@ -146,6 +177,20 @@ def test_qa_testset_saving_loading(tmp_path):
146177 )
147178
148179
180+ def test_qa_testset_saving_loading_swedish (tmp_path ):
181+ testset = QATestset (make_swedish_testset_samples ())
182+ path = tmp_path / "testset.jsonl"
183+ testset .save (path )
184+ loaded_testset = QATestset .load (path )
185+
186+ assert all (
187+ [
188+ original == loaded
189+ for original , loaded in zip (testset ._dataframe ["metadata" ], loaded_testset ._dataframe ["metadata" ])
190+ ]
191+ )
192+
193+
149194def test_metadata_value_retrieval ():
150195 testset = QATestset (make_testset_samples ())
151196
0 commit comments