Skip to content

Commit d885089

Browse files
Add test for issue #74
1 parent 16400d9 commit d885089

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

mcbackend/test_backend_clickhouse.py

+24
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,30 @@ def test_insert_draw(self):
271271
numpy.testing.assert_array_equal(v3, draw["v3"])
272272
pass
273273

274+
@pytest.mark.xfail(
275+
reason="Batch inserting assumes identical dict composition every time. See #74."
276+
)
277+
def test_insert_flaky_stats(self):
278+
"""Tries to append stats that only sometimes have an entry for a stat."""
279+
run, chains = fully_initialized(
280+
self.backend,
281+
RunMeta(
282+
sample_stats=[
283+
Variable("always", "int8"),
284+
Variable("sometimes", "bool"),
285+
]
286+
),
287+
)
288+
289+
chain = chains[0]
290+
chain.append({}, dict(always=1, sometimes=True))
291+
chain.append({}, dict(always=2))
292+
chain._commit()
293+
294+
tuple(chain.get_stats("always")) == (1, 2)
295+
assert tuple(chain.get_stats("sometimes")) == (True, None)
296+
pass
297+
274298
def test_get_row_at(self):
275299
run, chains = fully_initialized(
276300
self.backend,

0 commit comments

Comments
 (0)