From f268ddf94c1dfda26ae8135576ee4af91575fc95 Mon Sep 17 00:00:00 2001 From: JulienRemy Date: Mon, 23 Dec 2024 14:05:44 +0100 Subject: [PATCH] #1247 Missing test for `StructureType.__copy__` --- src/psyclone/tests/psyir/symbols/datatype_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/psyclone/tests/psyir/symbols/datatype_test.py b/src/psyclone/tests/psyir/symbols/datatype_test.py index 3025775ffc..2bba4e0521 100644 --- a/src/psyclone/tests/psyir/symbols/datatype_test.py +++ b/src/psyclone/tests/psyir/symbols/datatype_test.py @@ -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"]