From 9d0c2c484001b0af14df52a7269af79612194733 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Thu, 7 Sep 2023 10:38:53 -0500 Subject: [PATCH] uses lists --- tests/test_io_text.py | 46 +++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/tests/test_io_text.py b/tests/test_io_text.py index d275d7fa..dfe3a308 100644 --- a/tests/test_io_text.py +++ b/tests/test_io_text.py @@ -7,34 +7,38 @@ import dask_awkward as dak from dask_awkward.lib.testutils import assert_eq -text1 = """a sentence -one two three -one,two,three -abc 123 def 456 -this is a test ok ok ok -aaaaaaaaaaa bbbbbbbbbbbbb -ccccccccccccccccccccccccc -ddd ddd ddd ddd ddd ddd -asdf jkl""" - -text2 = """abc 123 -456 789 10,11,12 -dddddddd -jjjjjjjjjjj -lllllllll -oooooooooooo iiiiiiii nnnnnn -nlm abc 456""" +text1 = [ + "a sentence", + "one two three", + "one,two,three", + "abc 123 def 456", + "this is a test ok ok ok", + "aaaaaaaaaaa bbbbbbbbbbbbb", + "ccccccccccccccccccccccccc", + "ddd ddd ddd ddd ddd ddd", + "asdf jkl", +] + +text2 = [ + "abc 123", + "456 789 10,11,12", + "dddddddd", + "jjjjjjjjjjj", + "lllllllll", + "oooooooooooo iiiiiiii nnnnnn", + "nlm abc 456", +] def test_form_text(tmp_path_factory: pytest.TempPathFactory) -> None: p = tmp_path_factory.mktemp("from_text") with (p / "file1.txt").open("wt") as f: - print(text1, file=f) + f.write("\n".join(text1)) with (p / "file2.txt").open("wt") as f: - print(text2, file=f) + f.write("\n".join(text2)) - daa = dak.from_text(str(p / "*.txt")) - caa = ak.concatenate([ak.Array(text1.split("\n")), ak.Array(text2.split("\n"))]) + daa = dak.from_text([str(p / "file1.txt"), str(p / "file2.txt")]) + caa = ak.concatenate([ak.Array(text1), ak.Array(text2)]) assert daa.npartitions == 2