Skip to content

Commit

Permalink
Merge pull request #1542 from priyanshuone6/issue-1540
Browse files Browse the repository at this point in the history
Skip print_name setter
  • Loading branch information
valentinsulzer authored Jul 9, 2021
2 parents c421a91 + 66fe1bc commit d62c862
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pybamm/expression_tree/printing/print_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
def prettify_print_name(name):
"""Prettify print_name using regex"""

# Skip prettify_print_name() for cases like `new_copy()`
if "{" in name:
return name

# Return print_name if name exists in the dictionary
if name in PRINT_NAME_OVERRIDES:
return PRINT_NAME_OVERRIDES[name]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def test_prettify_print_name(self):
# Test greek letters
self.assertEqual(param1.delta_phi_n.print_name, r"\delta_\phi_n")

# Test new_copy()
param2 = pybamm.LeadAcidParameters()
x_n = pybamm.standard_spatial_vars.x_n
a_n = param2.a_n(x_n)
a_n.new_copy()


if __name__ == "__main__":
print("Add -v for more debug output")
Expand Down

0 comments on commit d62c862

Please sign in to comment.