File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -70,12 +70,14 @@ def add(self, x: float) -> None:
7070 self ._compress_until_ok ()
7171
7272 def extend (self , xs : Iterable [float ]) -> None :
73- buf = self ._levels [0 ]
7473 for x in xs :
7574 xv = float (x )
7675 if math .isnan (xv ) or math .isinf (xv ):
7776 raise ValueError ("values must be finite" )
78- buf .append (xv )
77+ # ``self._levels[0]`` can be replaced during compaction, so we must
78+ # append directly to the current buffer each iteration instead of
79+ # keeping a stale reference (which would silently drop values).
80+ self ._levels [0 ].append (xv )
7981 self ._n += 1
8082 if self ._capacity_exceeded ():
8183 self ._compress_until_ok ()
Original file line number Diff line number Diff line change 1+ """Pytest configuration ensuring the package is importable during tests."""
2+ from __future__ import annotations
3+
4+ import sys
5+ from pathlib import Path
6+
7+ # When pytest collects tests inside the installed package directory, the
8+ # repository root (which contains the ``kll_sketch`` package) might not be on
9+ # ``sys.path``. Add it explicitly so ``from kll_sketch import KLL`` works even
10+ # when the tests are executed without installing the project as a package.
11+ ROOT = Path (__file__ ).resolve ().parents [2 ]
12+ if str (ROOT ) not in sys .path :
13+ sys .path .insert (0 , str (ROOT ))
You can’t perform that action at this time.
0 commit comments