Skip to content

Commit 458aa4b

Browse files
change name of test util function
1 parent 6745d18 commit 458aa4b

13 files changed

+118
-120
lines changed

src/main/java/com/regnosys/rosetta/generator/python/expressions/PythonExpressionGenerator.xtend

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ class PythonExpressionGenerator {
290290
return '''rune_resolve_attr(switchAttribute,"«caseGuard.getSymbolGuard.getName()»")'''
291291
}
292292
}
293-
294-
295293

296294
private def String generateSwitchOperation(SwitchOperation expr, int ifLevel, boolean isLambda) {
297295
val attr = generateExpression(expr.argument, 0, isLambda)

src/test/java/com/regnosys/rosetta/generator/python/PythonGeneratorTestUtils.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class PythonGeneratorTestUtils {
211211
val python = generatePythonFromString (model);
212212
return python.get("src/com/_bundle.py").toString()
213213
}
214-
def assertStringInString (String generated, String expectedString) {
214+
def assertGeneratedContainsExpectedString (String generated, String expectedString) {
215215
assertTrue(generated.contains(expectedString),
216216
'''
217217
generated Python does not match expected
@@ -223,6 +223,6 @@ class PythonGeneratorTestUtils {
223223
def assertBundleContainsExpectedString(String model, String expectedString) {
224224
// Generate the bundle using the existing function
225225
val generatedBundle = generatePythonAndExtractBundle(model)
226-
assertStringInString(generatedBundle, expectedString)
226+
assertGeneratedContainsExpectedString(generatedBundle, expectedString)
227227
}
228228
}

src/test/java/com/regnosys/rosetta/generator/python/expression/PythonExpressionGeneratorTest.xtend

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PythonExpressionGeneratorTest {
3030
else False
3131
'''
3232
).toString()
33-
testUtils.assertStringInString (
33+
testUtils.assertGeneratedContainsExpectedString (
3434
pythonString,
3535
'''
3636
class com_rosetta_test_model_ArithmeticTest(BaseDataClass):
@@ -378,8 +378,8 @@ class PythonExpressionGeneratorTest {
378378
return True
379379

380380
return if_cond_fn(rune_all_elements(rune_get_only_element(rune_resolve_attr(self, "field1")), "=", com.rosetta.test.model.TestEnum.TestEnum.TEST_ENUM_VALUE_1), _then_fn0, _else_fn0)'''
381-
testUtils.assertStringInString (pythonString, expectedTestEnum)
382-
testUtils.assertStringInString (pythonString, expectedTest1)
381+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedTestEnum)
382+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedTest1)
383383
}
384384

385385
@Test
@@ -397,7 +397,7 @@ class PythonExpressionGeneratorTest {
397397
then aValue -> field1 only exists
398398
'''
399399
).toString();
400-
testUtils.assertStringInString(
400+
testUtils.assertGeneratedContainsExpectedString(
401401
pythonString,
402402
'''
403403
class com_rosetta_test_model_Test(BaseDataClass):
@@ -424,7 +424,7 @@ class PythonExpressionGeneratorTest {
424424
425425
return if_cond_fn(rune_attr_exists(rune_resolve_attr(rune_resolve_attr(self, "aValue"), "field1")), _then_fn0, _else_fn0)'''
426426
)
427-
testUtils.assertStringInString(
427+
testUtils.assertGeneratedContainsExpectedString(
428428
pythonString,
429429
'''
430430
class com_rosetta_test_model_A(BaseDataClass):
@@ -458,7 +458,7 @@ class PythonExpressionGeneratorTest {
458458
else False
459459
'''
460460
).toString()
461-
testUtils.assertStringInString(
461+
testUtils.assertGeneratedContainsExpectedString(
462462
pythonString,
463463
'''
464464
class com_rosetta_test_model_Test(BaseDataClass):
@@ -486,7 +486,7 @@ class PythonExpressionGeneratorTest {
486486
return if_cond_fn(rune_any_elements(rune_count(rune_resolve_attr(rune_resolve_attr(self, "aValue"), "field1")), "<>", rune_count(rune_resolve_attr(rune_resolve_attr(self, "aValue"), "field2"))), _then_fn0, _else_fn0)
487487
'''
488488
)
489-
testUtils.assertStringInString(
489+
testUtils.assertGeneratedContainsExpectedString(
490490
pythonString,
491491
'''
492492
class com_rosetta_test_model_A(BaseDataClass):
@@ -573,7 +573,7 @@ class PythonExpressionGeneratorTest {
573573
else field3=1
574574
'''
575575
).toString()
576-
testUtils.assertStringInString(
576+
testUtils.assertGeneratedContainsExpectedString(
577577
pythonString,
578578
'''
579579
class com_rosetta_test_model_Test(BaseDataClass):
@@ -604,7 +604,7 @@ class PythonExpressionGeneratorTest {
604604
605605
return if_cond_fn(rune_all_elements(rune_count(set(rune_resolve_attr(rune_resolve_attr(self, "aValue"), "field1"))), "=", 1), _then_fn0, _else_fn0)'''
606606
)
607-
testUtils.assertStringInString(
607+
testUtils.assertGeneratedContainsExpectedString(
608608
pythonString,
609609
'''
610610
class com_rosetta_test_model_A(BaseDataClass):
@@ -716,10 +716,10 @@ class PythonExpressionGeneratorTest {
716716
return True
717717
718718
return if_cond_fn(rune_all_elements(rune_resolve_attr(self, "field3"), "=", True), _then_fn0, _else_fn0)'''
719-
testUtils.assertStringInString (pythonString, expectedC)
720-
testUtils.assertStringInString (pythonString, expectedA)
721-
testUtils.assertStringInString (pythonString, expectedB)
722-
testUtils.assertStringInString (pythonString, expectedTest)
719+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedC)
720+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedA)
721+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedB)
722+
testUtils.assertGeneratedContainsExpectedString (pythonString, expectedTest)
723723
}
724724

725725
@Test
@@ -810,7 +810,7 @@ class PythonExpressionGeneratorTest {
810810
item = self
811811
return rune_all_elements([1, 2, 3], "=", (lambda item: rune_flatten_list(item))(list(map(lambda item: rune_resolve_attr(item, "numbers"), rune_resolve_attr(self, "bars")))))
812812
'''
813-
testUtils.assertStringInString(pythonString, expectedFoo)
813+
testUtils.assertGeneratedContainsExpectedString(pythonString, expectedFoo)
814814
}
815815

816816
@Disabled

src/test/java/com/regnosys/rosetta/generator/python/func/PythonFunctionsTest.xtend

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class PythonFunctionsTest {
492492
493493
return result
494494
'''
495-
testUtils.assertStringInString (generatedFunction, expected)
495+
testUtils.assertGeneratedContainsExpectedString (generatedFunction, expected)
496496
}
497497

498498
@Test

src/test/java/com/regnosys/rosetta/generator/python/generated_syntax/PythonBasicGeneratorTest.xtend

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class PythonBasicGeneratorTest {
5959
def void testBasicSingleProxy () {
6060
val python = getPython ();
6161
// check proxies
62-
testUtils.assertStringInString(
62+
testUtils.assertGeneratedContainsExpectedString(
6363
python.get("src/test/generated_syntax/basic/BasicSingle.py").toString(),
6464
'''
6565
# pylint: disable=unused-import
@@ -71,7 +71,7 @@ class PythonBasicGeneratorTest {
7171
def void testBasicListProxy () {
7272
val python = getPython ();
7373
// check proxies
74-
testUtils.assertStringInString(
74+
testUtils.assertGeneratedContainsExpectedString(
7575
python.get("src/test/generated_syntax/basic/BasicList.py").toString(),
7676
'''
7777
# pylint: disable=unused-import
@@ -83,7 +83,7 @@ class PythonBasicGeneratorTest {
8383
def void testRootProxy () {
8484
val python = getPython ();
8585
// check proxies
86-
testUtils.assertStringInString(
86+
testUtils.assertGeneratedContainsExpectedString(
8787
python.get("src/test/generated_syntax/basic/Root.py").toString(),
8888
'''
8989
# pylint: disable=unused-import
@@ -112,7 +112,7 @@ class PythonBasicGeneratorTest {
112112
stringType: str = Field(..., description='')
113113
timeType: datetime.time = Field(..., description='')
114114
'''
115-
testUtils.assertStringInString(generatedBundle, expectedBasicSingle)
115+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedBasicSingle)
116116
}
117117
@Test
118118
def void testExpectedBundleList () {
@@ -129,7 +129,7 @@ class PythonBasicGeneratorTest {
129129
stringTypes: list[str] = Field(..., description='', min_length=1)
130130
timeTypes: list[datetime.time] = Field(..., description='', min_length=1)
131131
'''
132-
testUtils.assertStringInString(generatedBundle, expectedBasicList)
132+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedBasicList)
133133
}
134134
@Test
135135
def void testExpectedBundleRoot () {
@@ -142,6 +142,6 @@ class PythonBasicGeneratorTest {
142142
basicSingle: Optional[Annotated[test_generated_syntax_basic_BasicSingle, test_generated_syntax_basic_BasicSingle.serializer(), test_generated_syntax_basic_BasicSingle.validator()]] = Field(None, description='')
143143
basicList: Optional[Annotated[test_generated_syntax_basic_BasicList, test_generated_syntax_basic_BasicList.serializer(), test_generated_syntax_basic_BasicList.validator()]] = Field(None, description='')
144144
'''
145-
testUtils.assertStringInString(generatedBundle, expectedRoot)
145+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedRoot)
146146
}
147147
}

src/test/java/com/regnosys/rosetta/generator/python/generated_syntax/PythonChoiceGeneratorTest.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PythonChoiceGeneratorTest {
2727
condition Choice: one-of
2828
''')
2929
// check proxies
30-
testUtils.assertStringInString(
30+
testUtils.assertGeneratedContainsExpectedString(
3131
python.get("src/test/generated_syntax/semantic/Choice.py").toString(),
3232
'''
3333
# pylint: disable=unused-import
@@ -47,6 +47,6 @@ class PythonChoiceGeneratorTest {
4747
item = self
4848
return rune_check_one_of(self, 'intType', 'stringType', necessity=True)
4949
'''
50-
testUtils.assertStringInString(generatedBundle, expectedChoice)
50+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedChoice)
5151
}
5252
}

src/test/java/com/regnosys/rosetta/generator/python/generated_syntax/PythonMetaDataGeneratorTest.xtend

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class PythonMetaDataGeneratorTest {
5555
@Test
5656
def void testAProxy() {
5757
val python = getPython()
58-
testUtils.assertStringInString(
58+
testUtils.assertGeneratedContainsExpectedString(
5959
python.get("src/test/generated_syntax/metadata/A.py").toString(),
6060
'''
6161
# pylint: disable=unused-import
@@ -67,7 +67,7 @@ class PythonMetaDataGeneratorTest {
6767
@Test
6868
def void testNodeRefProxy() {
6969
val python = getPython()
70-
testUtils.assertStringInString(
70+
testUtils.assertGeneratedContainsExpectedString(
7171
python.get("src/test/generated_syntax/metadata/NodeRef.py").toString(),
7272
'''
7373
# pylint: disable=unused-import
@@ -79,7 +79,7 @@ class PythonMetaDataGeneratorTest {
7979
@Test
8080
def void testAttributeRefProxy() {
8181
val python = getPython()
82-
testUtils.assertStringInString(
82+
testUtils.assertGeneratedContainsExpectedString(
8383
python.get("src/test/generated_syntax/metadata/AttributeRef.py").toString(),
8484
'''
8585
# pylint: disable=unused-import
@@ -91,7 +91,7 @@ class PythonMetaDataGeneratorTest {
9191
@Test
9292
def void testRootProxy() {
9393
val python = getPython()
94-
testUtils.assertStringInString(
94+
testUtils.assertGeneratedContainsExpectedString(
9595
python.get("src/test/generated_syntax/metadata/Root.py").toString(),
9696
'''
9797
# pylint: disable=unused-import
@@ -117,7 +117,7 @@ class PythonMetaDataGeneratorTest {
117117
_FQRTN = 'test.generated_syntax.metadata.A'
118118
fieldA: str = Field(..., description='')
119119
'''
120-
testUtils.assertStringInString(generatedBundle, expectedA)
120+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedA)
121121
}
122122

123123
@Test
@@ -136,7 +136,7 @@ class PythonMetaDataGeneratorTest {
136136
'dateReference': {'@ref', '@ref:external'}
137137
}
138138
'''
139-
testUtils.assertStringInString(generatedBundle, expectedAttributeRef)
139+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedAttributeRef)
140140
}
141141

142142
@Test
@@ -154,7 +154,7 @@ class PythonMetaDataGeneratorTest {
154154
'aReference': {'@ref', '@ref:external'}
155155
}
156156
'''
157-
testUtils.assertStringInString(generatedBundle, expectedNodeRef)
157+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedNodeRef)
158158
}
159159

160160
@Test
@@ -168,7 +168,7 @@ class PythonMetaDataGeneratorTest {
168168
nodeRef: Optional[Annotated[test_generated_syntax_metadata_NodeRef, test_generated_syntax_metadata_NodeRef.serializer(), test_generated_syntax_metadata_NodeRef.validator()]] = Field(None, description='')
169169
attributeRef: Optional[Annotated[test_generated_syntax_metadata_AttributeRef, test_generated_syntax_metadata_AttributeRef.serializer(), test_generated_syntax_metadata_AttributeRef.validator()]] = Field(None, description='')
170170
'''
171-
testUtils.assertStringInString(generatedBundle, expectedRoot)
171+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedRoot)
172172
}
173173

174174
@Test
@@ -182,6 +182,6 @@ class PythonMetaDataGeneratorTest {
182182
_FQRTN = 'test.generated_syntax.metadata.SchemeTest'
183183
a: str = Field(..., description='')
184184
'''
185-
testUtils.assertStringInString(generatedBundle, expectedScheme)
185+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedScheme)
186186
}
187187
}

src/test/java/com/regnosys/rosetta/generator/python/generated_syntax/PythonMetaKeyRefGeneratorTest.xtend

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PythonMetaKeyRefGeneratorTest {
3737
if (proxyKeyRef === null) {
3838
fail ('src/test/generated_syntax/meta_key_ref/KeyRef.py was not found')
3939
}
40-
testUtils.assertStringInString(
40+
testUtils.assertGeneratedContainsExpectedString(
4141
proxyKeyRef.toString(),
4242
'''
4343
# pylint: disable=unused-import
@@ -48,7 +48,7 @@ class PythonMetaKeyRefGeneratorTest {
4848
if (proxyScopedKeyRef === null) {
4949
fail ('src/test/generated_syntax/meta_key_ref/proxyScopedKeyRef.py was not found')
5050
}
51-
testUtils.assertStringInString(
51+
testUtils.assertGeneratedContainsExpectedString(
5252
python.get("src/test/generated_syntax/meta_key_ref/ScopedKeyRef.py").toString(),
5353
'''
5454
# pylint: disable=unused-import
@@ -69,7 +69,7 @@ class PythonMetaKeyRefGeneratorTest {
6969
'fieldA': {'@key', '@key:external', '@ref', '@ref:external'}
7070
}
7171
'''
72-
testUtils.assertStringInString(generatedBundle, expectedKeyRef)
72+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedKeyRef)
7373
val expectedScopedKeyRef =
7474
'''
7575
class test_generated_syntax_meta_key_ref_ScopedKeyRef(BaseDataClass):
@@ -80,6 +80,6 @@ class PythonMetaKeyRefGeneratorTest {
8080
'fieldA': {'@key:scoped', '@ref:scoped'}
8181
}
8282
'''
83-
testUtils.assertStringInString(generatedBundle, expectedScopedKeyRef)
83+
testUtils.assertGeneratedContainsExpectedString(generatedBundle, expectedScopedKeyRef)
8484
}
8585
}

src/test/java/com/regnosys/rosetta/generator/python/object/PythonEnumGeneratorTest.xtend

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PythonEnumGeneratorTest {
8383
item = self
8484
return rune_all_elements(rune_resolve_attr(self, "periodMultiplier"), ">", 0)
8585
'''
86-
testUtils.assertStringInString (generatedBundle, expected)
86+
testUtils.assertGeneratedContainsExpectedString (generatedBundle, expected)
8787

8888
}
8989
@Test
@@ -120,7 +120,7 @@ class PythonEnumGeneratorTest {
120120
Rolls on the 1st day of the month.
121121
"""
122122
'''
123-
testUtils.assertStringInString (pythonString, expected)
123+
testUtils.assertGeneratedContainsExpectedString (pythonString, expected)
124124
}
125125

126126
@Test

0 commit comments

Comments
 (0)