Skip to content

Commit

Permalink
added an integration test for the new append method
Browse files Browse the repository at this point in the history
  • Loading branch information
Seher Karakuzu authored and Seher Karakuzu committed Mar 13, 2024
1 parent dfb91fd commit e46aca8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions tiled/_tests/test_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,3 +489,32 @@ def test_write_with_specified_mimetype(tree):
),
],
)


def test_append_partition(tree):
with Context.from_app(build_app(tree)) as context:
client = from_context(context, include_data_sources=True)
df = pandas.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
structure = TableStructure.from_pandas(df)

x = client.new(
"table",
[
DataSource(
structure_family="table",
structure=structure,
mimetype="text/csv",
),
],
key="x",
)
x.write(df)

df2 = pandas.DataFrame({"A": [11, 12, 13], "B": [14, 15, 16]})

x.append_partition(df2, 0)
df3 = pandas.DataFrame({"A": [1, 2, 3, 11, 12, 13], "B": [4, 5, 6, 14, 15, 16]})

assert [row for col in x.columns for row in x[col]] == [
row for col in df3.columns for row in df3[col]
]
2 changes: 1 addition & 1 deletion tiled/client/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def append_partition(self, dataframe, partition):
headers={"Content-Type": APACHE_ARROW_FILE_MIME_TYPE},
)
)

def export(self, filepath, columns=None, *, format=None):
"""
Download data in some format and write to a file.
Expand Down

0 comments on commit e46aca8

Please sign in to comment.