Skip to content

Commit

Permalink
#1247 Missing test for StructureType.__copy__
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienRemy committed Dec 23, 2024
1 parent a98eba5 commit f268ddf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/psyclone/tests/psyir/symbols/datatype_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1062,3 +1062,17 @@ def test_structuretype_componenttype_eq():
comp2 = StructureType.ComponentType("george", INTEGER_TYPE,
Symbol.Visibility.PUBLIC, None)
assert comp1 != comp2


def test_structuretype___copy__():
'''Test the __copy__ method of StructureType.'''
stype = StructureType.create([
("nancy", INTEGER_TYPE, Symbol.Visibility.PUBLIC, None),
("peggy", REAL_TYPE, Symbol.Visibility.PRIVATE,
Literal("1.0", REAL_TYPE))])
copied = stype.__copy__()
assert copied == stype
assert copied is not stype
# The components should be the same objects
assert copied.components["nancy"] == stype.components["nancy"]
assert copied.components["peggy"] == stype.components["peggy"]

0 comments on commit f268ddf

Please sign in to comment.