Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ksagiyam/fix repr withmapping #182

Merged
merged 2 commits into from
Jul 15, 2023
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
6 changes: 6 additions & 0 deletions test/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,9 @@ def test_cells_2d(cell):
assert cell.num_peaks() == cell.num_vertices()


def test_tensorproductcell():
orig = ufl.TensorProductCell(ufl.interval, ufl.interval)
cell = orig.reconstruct()
assert cell.sub_cells() == orig.sub_cells()
assert cell.topological_dimension() == orig.topological_dimension()
assert cell.geometric_dimension() == orig.geometric_dimension()
6 changes: 6 additions & 0 deletions test/test_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,9 @@ def test_mse():

element = FiniteElement('GLL-Edge L2', interval, degree - 1)
assert element == eval(repr(element))


def test_withmapping():
base = FiniteElement("CG", interval, 1)
element = WithMapping(base, "identity")
assert element == eval(repr(element))
2 changes: 1 addition & 1 deletion ufl/cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ def reconstruct(self, **kwargs: typing.Any) -> Cell:
gdim = value
else:
raise TypeError(f"reconstruct() got unexpected keyword argument '{key}'")
return TensorProductCell(self._cellname, geometric_dimension=gdim)
return TensorProductCell(*self._cells, geometric_dimension=gdim)


def simplex(topological_dimension: int, geometric_dimension: typing.Optional[int] = None):
Expand Down
2 changes: 1 addition & 1 deletion ufl/finiteelement/hdivcurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __getattr__(self, attr):
(type(self).__name__, attr))

def __repr__(self):
return f"WithMapping({repr(self.wrapee)}, {self._mapping})"
return f"WithMapping({repr(self.wrapee)}, '{self._mapping}')"

def value_shape(self):
gdim = self.cell().geometric_dimension()
Expand Down