Skip to content
This repository has been archived by the owner on May 3, 2023. It is now read-only.

Commit

Permalink
feat: add test for chunking logic
Browse files Browse the repository at this point in the history
  • Loading branch information
frillecode committed Sep 30, 2022
1 parent 94af649 commit 199ee6b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_timeseriesflattener/test_add_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from psycop_feature_generation.loaders.raw.load_text import ( # noqa pylint: disable=unused-import
load_synth_notes,
_chunk_text,
)
from psycop_feature_generation.timeseriesflattener import (
FlattenedDataset,
Expand Down Expand Up @@ -579,3 +580,16 @@ def test_add_hf_text_data():

# 768 nas = 2 ids * 384 predictors with lookbehind 1 day. First get sum of each column. Then get sum of the row.
assert outcome_df.isna().sum().sum() == 768


def test_chunk_text():
text = "This is a test. This is another test. This is a third test. This is a fourth test."
expected = [
'This is a test.',
'This is another test.',
'This is a third',
'test. This is a'
]

assert _chunk_text(text, 4) == expected

0 comments on commit 199ee6b

Please sign in to comment.