Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/tests/test_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ def test_bad_offsets(self):

def test_replace_with_wrong_class(self):
t = self.table_class()
with pytest.raises(TypeError, match="wrong type"):
with pytest.raises(TypeError, match="is required"):
t.replace_with(tskit.BaseTable(None, None))


Expand Down
15 changes: 1 addition & 14 deletions python/tskit/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,20 +591,7 @@ def append(self, row):

def replace_with(self, other):
# Overwrite the contents of this table with a copy of the other table
params = {}
for column in self.column_names:
try:
params[column] = getattr(other, column)
except AttributeError:
raise TypeError(
"Replacement table has wrong type: it lacks a {column} column"
)
try:
# Not all tables have a metadata_schema: if they do, encode it with repr
params["metadata_schema"] = repr(other.metadata_schema)
except AttributeError:
pass
self.set_columns(**params)
self.set_columns(**other.asdict())

def clear(self):
"""
Expand Down