@@ -272,6 +272,257 @@ FASTPythonImporterTest >> testAsPatternWithList [
272272 self assert: (self topEntity isOfType: FASTPyPassStatement )
273273]
274274
275+ { #category : ' tests - with statement' }
276+ FASTPythonImporterTest >> testAsPatternWithSourceAttributeAccess [
277+ < generated>
278+ " Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
279+ Regenerate executing: self regenerateTest: #testAsPatternWithSourceAttributeAccess "
280+
281+ self parse: ' with x.y as f: pass' .
282+
283+ self assert: (fast allWithType: FASTPyAsPattern ) size equals: 1 .
284+ self assert: (fast allWithType: FASTPyAttributeAccess ) size equals: 1 .
285+ self assert: (fast allWithType: FASTPyIdentifier ) size equals: 2 .
286+ self assert: (fast allWithType: FASTPyModule ) size equals: 1 .
287+ self assert: (fast allWithType: FASTPyPassStatement ) size equals: 1 .
288+ self assert: (fast allWithType: FASTPyVariable ) size equals: 1 .
289+ self assert: (fast allWithType: FASTPyWithStatement ) size equals: 1 .
290+
291+ stack push: fast rootEntities anyOne containedEntities first.
292+ self assert: self topEntity sourceCode equals: ' with x.y as f: pass' .
293+ self assert: (self topEntity isOfType: FASTPyWithStatement ).
294+ self assert: (self topEntity isOfType: FASTTStatementBlock ).
295+
296+ " Testing value of multivalued relation items"
297+ self assert: self topEntity items size equals: 1 .
298+
299+ stack push: (stack top items at: 1 ).
300+ self assert: self topEntity sourceCode equals: ' x.y as f' .
301+ self assert: (self topEntity isOfType: FASTPyAsPattern ).
302+
303+ " Testing value of monovalue relation source"
304+ self assert: self topEntity source isNotNil.
305+
306+ stack push: self topEntity source.
307+ self assert: self topEntity sourceCode equals: ' x.y' .
308+ self assert: (self topEntity isOfType: FASTPyAttributeAccess ).
309+
310+ " Testing value of monovalue relation attribute"
311+ self assert: self topEntity attribute isNotNil.
312+
313+ stack push: self topEntity attribute.
314+ self assert: self topEntity sourceCode equals: ' y' .
315+ self assert: (self topEntity isOfType: FASTPyVariable ).
316+ self assert: (self topEntity isOfType: FASTTVariableEntity ).
317+ stack pop.
318+
319+ " Testing value of monovalue relation object"
320+ self assert: self topEntity object isNotNil.
321+
322+ stack push: self topEntity object.
323+ self assert: self topEntity sourceCode equals: ' x' .
324+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
325+ stack pop.
326+ stack pop.
327+
328+ " Testing value of monovalue relation target"
329+ self assert: self topEntity target isNotNil.
330+
331+ stack push: self topEntity target.
332+ self assert: self topEntity sourceCode equals: ' f' .
333+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
334+ stack pop.
335+ stack pop.
336+
337+ " Testing value of multivalued relation statements"
338+ self assert: self topEntity statements size equals: 1 .
339+
340+ stack push: (stack top statements at: 1 ).
341+ self assert: self topEntity sourceCode equals: ' pass' .
342+ self assert: (self topEntity isOfType: FASTPyPassStatement )
343+ ]
344+
345+ { #category : ' tests - with statement' }
346+ FASTPythonImporterTest >> testAsPatternWithSourceCall [
347+ < generated>
348+ " Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
349+ Regenerate executing: self regenerateTest: #testAsPatternWithSourceCall "
350+
351+ self parse: ' with x() as f: pass' .
352+
353+ self assert: (fast allWithType: FASTPyAsPattern ) size equals: 1 .
354+ self assert: (fast allWithType: FASTPyCall ) size equals: 1 .
355+ self assert: (fast allWithType: FASTPyIdentifier ) size equals: 2 .
356+ self assert: (fast allWithType: FASTPyModule ) size equals: 1 .
357+ self assert: (fast allWithType: FASTPyPassStatement ) size equals: 1 .
358+ self assert: (fast allWithType: FASTPyWithStatement ) size equals: 1 .
359+
360+ stack push: fast rootEntities anyOne containedEntities first.
361+ self assert: self topEntity sourceCode equals: ' with x() as f: pass' .
362+ self assert: (self topEntity isOfType: FASTPyWithStatement ).
363+ self assert: (self topEntity isOfType: FASTTStatementBlock ).
364+
365+ " Testing value of multivalued relation items"
366+ self assert: self topEntity items size equals: 1 .
367+
368+ stack push: (stack top items at: 1 ).
369+ self assert: self topEntity sourceCode equals: ' x() as f' .
370+ self assert: (self topEntity isOfType: FASTPyAsPattern ).
371+
372+ " Testing value of monovalue relation source"
373+ self assert: self topEntity source isNotNil.
374+
375+ stack push: self topEntity source.
376+ self assert: self topEntity sourceCode equals: ' x()' .
377+ self assert: (self topEntity isOfType: FASTPyCall ).
378+ self assert: (self topEntity isOfType: FASTTInvocation ).
379+ self assert: (self topEntity isOfType: FASTTWithArguments ).
380+
381+ " Testing value of monovalue relation callee"
382+ self assert: self topEntity callee isNotNil.
383+
384+ stack push: self topEntity callee.
385+ self assert: self topEntity sourceCode equals: ' x' .
386+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
387+ stack pop.
388+ stack pop.
389+
390+ " Testing value of monovalue relation target"
391+ self assert: self topEntity target isNotNil.
392+
393+ stack push: self topEntity target.
394+ self assert: self topEntity sourceCode equals: ' f' .
395+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
396+ stack pop.
397+ stack pop.
398+
399+ " Testing value of multivalued relation statements"
400+ self assert: self topEntity statements size equals: 1 .
401+
402+ stack push: (stack top statements at: 1 ).
403+ self assert: self topEntity sourceCode equals: ' pass' .
404+ self assert: (self topEntity isOfType: FASTPyPassStatement )
405+ ]
406+
407+ { #category : ' tests - with statement' }
408+ FASTPythonImporterTest >> testAsPatternWithSourceIdentifier [
409+ < generated>
410+ " Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
411+ Regenerate executing: self regenerateTest: #testAsPatternWithSourceIdentifier "
412+
413+ self parse: ' with x as f: pass' .
414+
415+ self assert: (fast allWithType: FASTPyAsPattern ) size equals: 1 .
416+ self assert: (fast allWithType: FASTPyIdentifier ) size equals: 2 .
417+ self assert: (fast allWithType: FASTPyModule ) size equals: 1 .
418+ self assert: (fast allWithType: FASTPyPassStatement ) size equals: 1 .
419+ self assert: (fast allWithType: FASTPyWithStatement ) size equals: 1 .
420+
421+ stack push: fast rootEntities anyOne containedEntities first.
422+ self assert: self topEntity sourceCode equals: ' with x as f: pass' .
423+ self assert: (self topEntity isOfType: FASTPyWithStatement ).
424+ self assert: (self topEntity isOfType: FASTTStatementBlock ).
425+
426+ " Testing value of multivalued relation items"
427+ self assert: self topEntity items size equals: 1 .
428+
429+ stack push: (stack top items at: 1 ).
430+ self assert: self topEntity sourceCode equals: ' x as f' .
431+ self assert: (self topEntity isOfType: FASTPyAsPattern ).
432+
433+ " Testing value of monovalue relation source"
434+ self assert: self topEntity source isNotNil.
435+
436+ stack push: self topEntity source.
437+ self assert: self topEntity sourceCode equals: ' x' .
438+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
439+ stack pop.
440+
441+ " Testing value of monovalue relation target"
442+ self assert: self topEntity target isNotNil.
443+
444+ stack push: self topEntity target.
445+ self assert: self topEntity sourceCode equals: ' f' .
446+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
447+ stack pop.
448+ stack pop.
449+
450+ " Testing value of multivalued relation statements"
451+ self assert: self topEntity statements size equals: 1 .
452+
453+ stack push: (stack top statements at: 1 ).
454+ self assert: self topEntity sourceCode equals: ' pass' .
455+ self assert: (self topEntity isOfType: FASTPyPassStatement )
456+ ]
457+
458+ { #category : ' tests - with statement' }
459+ FASTPythonImporterTest >> testAsPatternWithSourceSubscript [
460+ < generated>
461+ " Generated as regression test by FASTPyImporterTestGenerator>>#generateTestNamed:fromCode:protocol:
462+ Regenerate executing: self regenerateTest: #testAsPatternWithSourceSubscript "
463+
464+ self parse: ' with x[y] as f: pass' .
465+
466+ self assert: (fast allWithType: FASTPyAsPattern ) size equals: 1 .
467+ self assert: (fast allWithType: FASTPyIdentifier ) size equals: 3 .
468+ self assert: (fast allWithType: FASTPyModule ) size equals: 1 .
469+ self assert: (fast allWithType: FASTPyPassStatement ) size equals: 1 .
470+ self assert: (fast allWithType: FASTPySubscript ) size equals: 1 .
471+ self assert: (fast allWithType: FASTPyWithStatement ) size equals: 1 .
472+
473+ stack push: fast rootEntities anyOne containedEntities first.
474+ self assert: self topEntity sourceCode equals: ' with x[y] as f: pass' .
475+ self assert: (self topEntity isOfType: FASTPyWithStatement ).
476+ self assert: (self topEntity isOfType: FASTTStatementBlock ).
477+
478+ " Testing value of multivalued relation items"
479+ self assert: self topEntity items size equals: 1 .
480+
481+ stack push: (stack top items at: 1 ).
482+ self assert: self topEntity sourceCode equals: ' x[y] as f' .
483+ self assert: (self topEntity isOfType: FASTPyAsPattern ).
484+
485+ " Testing value of monovalue relation source"
486+ self assert: self topEntity source isNotNil.
487+
488+ stack push: self topEntity source.
489+ self assert: self topEntity sourceCode equals: ' x[y]' .
490+ self assert: (self topEntity isOfType: FASTPySubscript ).
491+
492+ " Testing value of multivalued relation indices"
493+ self assert: self topEntity indices size equals: 1 .
494+
495+ stack push: (stack top indices at: 1 ).
496+ self assert: self topEntity sourceCode equals: ' y' .
497+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
498+ stack pop.
499+
500+ " Testing value of monovalue relation value"
501+ self assert: self topEntity value isNotNil.
502+
503+ stack push: self topEntity value.
504+ self assert: self topEntity sourceCode equals: ' x' .
505+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
506+ stack pop.
507+ stack pop.
508+
509+ " Testing value of monovalue relation target"
510+ self assert: self topEntity target isNotNil.
511+
512+ stack push: self topEntity target.
513+ self assert: self topEntity sourceCode equals: ' f' .
514+ self assert: (self topEntity isOfType: FASTPyIdentifier ).
515+ stack pop.
516+ stack pop.
517+
518+ " Testing value of multivalued relation statements"
519+ self assert: self topEntity statements size equals: 1 .
520+
521+ stack push: (stack top statements at: 1 ).
522+ self assert: self topEntity sourceCode equals: ' pass' .
523+ self assert: (self topEntity isOfType: FASTPyPassStatement )
524+ ]
525+
275526{ #category : ' tests - with statement' }
276527FASTPythonImporterTest >> testAsPatternWithSubscript [
277528 < generated>
0 commit comments