@alloy-js/python 0.5.0-dev.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/dev/src/components/CallSignature.js +2 -2
  3. package/dist/dev/src/components/CallSignature.js.map +1 -1
  4. package/dist/dev/src/components/ConstructorDeclaration.js +1 -1
  5. package/dist/dev/src/components/ConstructorDeclaration.js.map +1 -1
  6. package/dist/dev/src/components/DataclassDeclaration.js +5 -5
  7. package/dist/dev/src/components/DataclassDeclaration.js.map +1 -1
  8. package/dist/dev/src/components/FunctionBase.js +9 -9
  9. package/dist/dev/src/components/FunctionBase.js.map +1 -1
  10. package/dist/dev/src/components/PropertyDeclaration.js +8 -8
  11. package/dist/dev/src/components/PropertyDeclaration.js.map +1 -1
  12. package/dist/dev/src/components/PyDoc.js +64 -64
  13. package/dist/dev/src/components/PyDoc.js.map +1 -1
  14. package/dist/dev/src/components/PydanticClassDeclaration.js +5 -5
  15. package/dist/dev/src/components/PydanticClassDeclaration.js.map +1 -1
  16. package/dist/dev/src/components/SourceFile.js +44 -32
  17. package/dist/dev/src/components/SourceFile.js.map +1 -1
  18. package/dist/dev/src/symbols/python-output-symbol.js.map +1 -1
  19. package/dist/dev/test/callsignatures.test.js +471 -297
  20. package/dist/dev/test/callsignatures.test.js.map +1 -1
  21. package/dist/dev/test/class-method-declaration.test.js +21 -10
  22. package/dist/dev/test/class-method-declaration.test.js.map +1 -1
  23. package/dist/dev/test/classdeclarations.test.js +459 -393
  24. package/dist/dev/test/classdeclarations.test.js.map +1 -1
  25. package/dist/dev/test/classinstantiations.test.js +201 -168
  26. package/dist/dev/test/classinstantiations.test.js.map +1 -1
  27. package/dist/dev/test/constructordeclaration.test.js +22 -11
  28. package/dist/dev/test/constructordeclaration.test.js.map +1 -1
  29. package/dist/dev/test/dataclassdeclarations.test.js +322 -368
  30. package/dist/dev/test/dataclassdeclarations.test.js.map +1 -1
  31. package/dist/dev/test/decoratorlist.test.js +96 -49
  32. package/dist/dev/test/decoratorlist.test.js.map +1 -1
  33. package/dist/dev/test/dundermethoddeclaration.test.js +22 -11
  34. package/dist/dev/test/dundermethoddeclaration.test.js.map +1 -1
  35. package/dist/dev/test/enums.test.js +218 -184
  36. package/dist/dev/test/enums.test.js.map +1 -1
  37. package/dist/dev/test/externals.test.js +57 -45
  38. package/dist/dev/test/externals.test.js.map +1 -1
  39. package/dist/dev/test/factories.test.js +124 -50
  40. package/dist/dev/test/factories.test.js.map +1 -1
  41. package/dist/dev/test/functioncallexpressions.test.js +199 -164
  42. package/dist/dev/test/functioncallexpressions.test.js.map +1 -1
  43. package/dist/dev/test/functiondeclaration.test.js +439 -272
  44. package/dist/dev/test/functiondeclaration.test.js.map +1 -1
  45. package/dist/dev/test/imports.test.js +273 -221
  46. package/dist/dev/test/imports.test.js.map +1 -1
  47. package/dist/dev/test/memberexpressions.test.js +1237 -972
  48. package/dist/dev/test/memberexpressions.test.js.map +1 -1
  49. package/dist/dev/test/methoddeclaration.test.js +142 -78
  50. package/dist/dev/test/methoddeclaration.test.js.map +1 -1
  51. package/dist/dev/test/namepolicies.test.js +130 -94
  52. package/dist/dev/test/namepolicies.test.js.map +1 -1
  53. package/dist/dev/test/propertydeclaration.test.js +88 -59
  54. package/dist/dev/test/propertydeclaration.test.js.map +1 -1
  55. package/dist/dev/test/pydanticclassdeclarations.test.js +299 -347
  56. package/dist/dev/test/pydanticclassdeclarations.test.js.map +1 -1
  57. package/dist/dev/test/pydocs.test.js +888 -715
  58. package/dist/dev/test/pydocs.test.js.map +1 -1
  59. package/dist/dev/test/references.test.js +42 -35
  60. package/dist/dev/test/references.test.js.map +1 -1
  61. package/dist/dev/test/sourcefiles.test.js +1109 -841
  62. package/dist/dev/test/sourcefiles.test.js.map +1 -1
  63. package/dist/dev/test/staticmethoddeclaration.test.js +21 -10
  64. package/dist/dev/test/staticmethoddeclaration.test.js.map +1 -1
  65. package/dist/dev/test/type-checking-imports.test.js +408 -359
  66. package/dist/dev/test/type-checking-imports.test.js.map +1 -1
  67. package/dist/dev/test/typereference.test.js +55 -40
  68. package/dist/dev/test/typereference.test.js.map +1 -1
  69. package/dist/dev/test/uniontypeexpression.test.js +222 -146
  70. package/dist/dev/test/uniontypeexpression.test.js.map +1 -1
  71. package/dist/dev/test/utils.js +39 -77
  72. package/dist/dev/test/utils.js.map +1 -1
  73. package/dist/dev/test/values.test.js +237 -101
  74. package/dist/dev/test/values.test.js.map +1 -1
  75. package/dist/dev/test/variables.test.js +321 -203
  76. package/dist/dev/test/variables.test.js.map +1 -1
  77. package/dist/dev/test/vitest.setup.js +2 -0
  78. package/dist/dev/test/vitest.setup.js.map +1 -0
  79. package/dist/src/components/CallSignature.d.ts.map +1 -1
  80. package/dist/src/components/CallSignature.js.map +1 -1
  81. package/dist/src/components/ConstructorDeclaration.d.ts.map +1 -1
  82. package/dist/src/components/ConstructorDeclaration.js.map +1 -1
  83. package/dist/src/components/DataclassDeclaration.d.ts.map +1 -1
  84. package/dist/src/components/DataclassDeclaration.js.map +1 -1
  85. package/dist/src/components/FunctionBase.d.ts.map +1 -1
  86. package/dist/src/components/FunctionBase.js.map +1 -1
  87. package/dist/src/components/PropertyDeclaration.d.ts.map +1 -1
  88. package/dist/src/components/PropertyDeclaration.js.map +1 -1
  89. package/dist/src/components/PyDoc.d.ts.map +1 -1
  90. package/dist/src/components/PyDoc.js.map +1 -1
  91. package/dist/src/components/PydanticClassDeclaration.d.ts.map +1 -1
  92. package/dist/src/components/PydanticClassDeclaration.js.map +1 -1
  93. package/dist/src/components/SourceFile.d.ts +2 -2
  94. package/dist/src/components/SourceFile.d.ts.map +1 -1
  95. package/dist/src/components/SourceFile.js +12 -0
  96. package/dist/src/components/SourceFile.js.map +1 -1
  97. package/dist/src/symbols/python-output-symbol.d.ts.map +1 -1
  98. package/dist/src/symbols/python-output-symbol.js.map +1 -1
  99. package/dist/test/callsignatures.test.js +346 -272
  100. package/dist/test/callsignatures.test.js.map +1 -1
  101. package/dist/test/class-method-declaration.test.js +7 -4
  102. package/dist/test/class-method-declaration.test.js.map +1 -1
  103. package/dist/test/classdeclarations.test.js +302 -288
  104. package/dist/test/classdeclarations.test.js.map +1 -1
  105. package/dist/test/classinstantiations.test.js +112 -103
  106. package/dist/test/classinstantiations.test.js.map +1 -1
  107. package/dist/test/constructordeclaration.test.js +7 -4
  108. package/dist/test/constructordeclaration.test.js.map +1 -1
  109. package/dist/test/dataclassdeclarations.test.js +134 -184
  110. package/dist/test/dataclassdeclarations.test.js.map +1 -1
  111. package/dist/test/decoratorlist.test.js +59 -36
  112. package/dist/test/decoratorlist.test.js.map +1 -1
  113. package/dist/test/dundermethoddeclaration.test.js +7 -4
  114. package/dist/test/dundermethoddeclaration.test.js.map +1 -1
  115. package/dist/test/enums.test.js +161 -159
  116. package/dist/test/enums.test.js.map +1 -1
  117. package/dist/test/externals.test.js +24 -24
  118. package/dist/test/externals.test.js.map +1 -1
  119. package/dist/test/factories.test.js +75 -33
  120. package/dist/test/factories.test.js.map +1 -1
  121. package/dist/test/functioncallexpressions.test.js +117 -106
  122. package/dist/test/functioncallexpressions.test.js.map +1 -1
  123. package/dist/test/functiondeclaration.test.js +247 -180
  124. package/dist/test/functiondeclaration.test.js.map +1 -1
  125. package/dist/test/imports.test.js +171 -143
  126. package/dist/test/imports.test.js.map +1 -1
  127. package/dist/test/memberexpressions.test.js +582 -453
  128. package/dist/test/memberexpressions.test.js.map +1 -1
  129. package/dist/test/methoddeclaration.test.js +66 -46
  130. package/dist/test/methoddeclaration.test.js.map +1 -1
  131. package/dist/test/namepolicies.test.js +90 -78
  132. package/dist/test/namepolicies.test.js.map +1 -1
  133. package/dist/test/propertydeclaration.test.js +25 -20
  134. package/dist/test/propertydeclaration.test.js.map +1 -1
  135. package/dist/test/pydanticclassdeclarations.test.js +134 -190
  136. package/dist/test/pydanticclassdeclarations.test.js.map +1 -1
  137. package/dist/test/pydocs.test.js +573 -532
  138. package/dist/test/pydocs.test.js.map +1 -1
  139. package/dist/test/references.test.js +31 -28
  140. package/dist/test/references.test.js.map +1 -1
  141. package/dist/test/sourcefiles.test.js +700 -580
  142. package/dist/test/sourcefiles.test.js.map +1 -1
  143. package/dist/test/staticmethoddeclaration.test.js +7 -4
  144. package/dist/test/staticmethoddeclaration.test.js.map +1 -1
  145. package/dist/test/type-checking-imports.test.js +297 -284
  146. package/dist/test/type-checking-imports.test.js.map +1 -1
  147. package/dist/test/typereference.test.js +29 -22
  148. package/dist/test/typereference.test.js.map +1 -1
  149. package/dist/test/uniontypeexpression.test.js +124 -88
  150. package/dist/test/uniontypeexpression.test.js.map +1 -1
  151. package/dist/test/utils.d.ts +10 -17
  152. package/dist/test/utils.d.ts.map +1 -1
  153. package/dist/test/utils.js +32 -74
  154. package/dist/test/utils.js.map +1 -1
  155. package/dist/test/values.test.js +135 -67
  156. package/dist/test/values.test.js.map +1 -1
  157. package/dist/test/variables.test.js +201 -151
  158. package/dist/test/variables.test.js.map +1 -1
  159. package/dist/test/vitest.setup.d.ts +2 -0
  160. package/dist/test/vitest.setup.d.ts.map +1 -0
  161. package/dist/test/vitest.setup.js +2 -0
  162. package/dist/test/vitest.setup.js.map +1 -0
  163. package/dist/tsconfig.tsbuildinfo +1 -1
  164. package/docs/api/components/FunctionalEnumDeclaration.md +3 -6
  165. package/docs/api/components/MemberExpression.md +1 -5
  166. package/docs/api/components/SourceFile.md +20 -8
  167. package/docs/api/components/index.md +0 -2
  168. package/docs/api/functions/isTypeRefContext.md +1 -1
  169. package/docs/api/index.md +2 -2
  170. package/docs/api/types/ReferenceProps.md +7 -0
  171. package/docs/api/types/TypeRefContextProps.md +7 -0
  172. package/docs/api/types/index.md +2 -0
  173. package/package.json +11 -10
  174. package/src/components/CallSignature.tsx +4 -2
  175. package/src/components/ConstructorDeclaration.tsx +4 -2
  176. package/src/components/DataclassDeclaration.tsx +1 -2
  177. package/src/components/FunctionBase.tsx +1 -2
  178. package/src/components/PropertyDeclaration.tsx +8 -4
  179. package/src/components/PyDoc.tsx +12 -6
  180. package/src/components/PydanticClassDeclaration.tsx +1 -2
  181. package/src/components/SourceFile.tsx +6 -1
  182. package/src/symbols/python-output-symbol.ts +1 -2
  183. package/temp/api.json +107 -61
  184. package/test/callsignatures.test.tsx +309 -283
  185. package/test/class-method-declaration.test.tsx +3 -4
  186. package/test/classdeclarations.test.tsx +263 -248
  187. package/test/classinstantiations.test.tsx +115 -109
  188. package/test/constructordeclaration.test.tsx +9 -6
  189. package/test/dataclassdeclarations.test.tsx +243 -361
  190. package/test/decoratorlist.test.tsx +78 -59
  191. package/test/dundermethoddeclaration.test.tsx +3 -4
  192. package/test/enums.test.tsx +65 -81
  193. package/test/externals.test.tsx +25 -25
  194. package/test/factories.test.tsx +64 -22
  195. package/test/functioncallexpressions.test.tsx +123 -109
  196. package/test/functiondeclaration.test.tsx +209 -148
  197. package/test/imports.test.tsx +119 -91
  198. package/test/memberexpressions.test.tsx +265 -207
  199. package/test/methoddeclaration.test.tsx +84 -63
  200. package/test/namepolicies.test.tsx +69 -69
  201. package/test/propertydeclaration.test.tsx +7 -8
  202. package/test/pydanticclassdeclarations.test.tsx +355 -487
  203. package/test/pydocs.test.tsx +531 -579
  204. package/test/references.test.tsx +24 -23
  205. package/test/sourcefiles.test.tsx +527 -492
  206. package/test/staticmethoddeclaration.test.tsx +3 -4
  207. package/test/type-checking-imports.test.tsx +206 -218
  208. package/test/typereference.test.tsx +15 -12
  209. package/test/uniontypeexpression.test.tsx +74 -61
  210. package/test/utils.tsx +26 -110
  211. package/test/values.test.tsx +82 -32
  212. package/test/variables.test.tsx +162 -142
  213. package/test/vitest.setup.ts +1 -0
  214. package/tsdoc-metadata.json +1 -1
  215. package/vitest.config.ts +4 -0
  216. package/docs/api/components/Reference.md +0 -31
  217. package/docs/api/components/TypeRefContext.md +0 -41
@@ -1 +1 @@
1
- {"version":3,"names":["refkey","d","describe","expect","it","py","toSourceText","result","_$createComponent","FunctionCallExpression","target","toRenderTo","args","methodRef","StatementList","children","FunctionDeclaration","name","Atom","jsValue","expected","returnType","parameters","type","VariableDeclaration","initializer","callStatementVar"],"sources":["../../test/functioncallexpressions.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,CAAC,QAAQ,wBAAwB;AAC1C,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,OAAO,KAAKC,EAAE,MAAM,iBAAiB;AACrC,SAASC,YAAY;AAErBJ,QAAQ,CAAC,wBAAwB,EAAE,MAAM;EACvCE,EAAE,CAAC,SAAS,EAAE,MAAM;IAClB,MAAMG,MAAM,GAAGD,YAAY,CAAC,CAAAE,iBAAA,CAAEH,EAAE,CAACI,sBAAsB;MAACC,MAAM;IAAA,GAAU,CAAC;IACzEP,MAAM,CAACI,MAAM,CAAC,CAACI,UAAU,CAACV,CAAC;AAC/B;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFG,EAAE,CAAC,mBAAmB,EAAE,MAAM;IAC5B,MAAMG,MAAM,GAAGD,YAAY,CAAC,CAAAE,iBAAA,CACzBH,EAAE,CAACI,sBAAsB;MAACC,MAAM;MAAOE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG;IAAC,GACzD,CAAC;IACFT,MAAM,CAACI,MAAM,CAAC,CAACI,UAAU,CAACV,CAAC;AAC/B;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFG,EAAE,CAAC,8BAA8B,EAAE,MAAM;IACvC;IACA,MAAMS,SAAS,GAAGb,MAAM,CAAC,CAAC;IAC1B,MAAMO,MAAM,GAAGD,YAAY,CAAC,CAAAE,iBAAA,CACzBH,EAAE,CAACS,aAAa;MAAA,IAAAC,SAAA;QAAA,QAAAP,iBAAA,CACdH,EAAE,CAACW,mBAAmB;UAACC,IAAI;UAAWjB,MAAM,EAAEa;QAAS,IAAAL,iBAAA,CACvDH,EAAE,CAACI,sBAAsB;UACxB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I,sBAAsB;UACxBC,MAAM,EAAE,gBAAgB;UAAA,IACxBE,IAAIA,CAAA;YAAA,OAAE,CAAAJ,iBAAA,CACHH,EAAE,CAACa,IAAI;cAACC,OAAO,EAAE;YAAQ,IAAAX,iBAAA,CACzBH,EAAE,CAACmB,mBAAmB;cACrBP,IAAI;cACJQ,WAAW,EAAE,EAAE;cACfC,gBAAgB;YAAA,IAAAlB,iBAAA,CAEjBH,EAAE,CAACmB,mBAAmB;cACrBP,IAAI;cACJQ,WAAW,EAAE,IAAI;cACjBC,gBAAgB;YAAA,GAEnB;UAAA;QAAA;MAAA;IAAA,GAGN,CAAC;IACF,MAAMN,QAAQ,GAAGnB,CAAC;AACtB;AACA,KAAK;IACDE,MAAM,CAACI,MAAM,CAAC,CAACI,UAAU,CAACS,QAAQ,CAAC;EACrC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["refkey","describe","expect","it","py","TestOutput","_$createComponent","children","FunctionCallExpression","target","toRenderTo","args","methodRef","StatementList","FunctionDeclaration","name","Atom","jsValue","returnType","parameters","type","VariableDeclaration","initializer","callStatementVar"],"sources":["../../test/functioncallexpressions.test.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,MAAM,QAAQ,gBAAgB;AACvC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,OAAO,KAAKC,EAAE,MAAM,iBAAiB;AACrC,SAASC,UAAU,QAAQ,YAAY;AAEvCJ,QAAQ,CAAC,wBAAwB,EAAE,MAAM;EACvCE,EAAE,CAAC,SAAS,EAAE,MAAM;IAClBD,MAAM,CAAAI,iBAAA,CACHD,UAAU;MAAA,IAAAE,SAAA;QAAA,OAAAD,iBAAA,CACRF,EAAE,CAACI,sBAAsB;UAACC,MAAM;QAAA;MAAA;IAAA,EAErC,CAAC,CAACC,UAAU,CACV;AACN;AACA,KACI,CAAC;EACH,CAAC,CAAC;EAEFP,EAAE,CAAC,mBAAmB,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AEjBF,EAAE,CAACiB,mBAAmB;kBACrBN,IAAI;kBACJO,WAAW,EAAE,EAAE;kBACfC,gBAAgB;gBAAA,IAAAjB,iBAAA,CAEjBF,EAAE,CAACiB,mBAAmB;kBACrBN,IAAI;kBACJO,WAAW,EAAE,IAAI;kBACjBC,gBAAgB;gBAAA,GAEnB;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA,EAIT,CAAC,CAACb,UAAU,CACV;AACN;AACA,KACI,CAAC;EACH,CAAC,CAAC;EAEFP,EAAE,CAAC,+DAA+D,EAAE,MAAM;IACxED,MAAM,CAAAI,iBAAA,CACHD,UAAU;MAAA,IAAAE,SAAA;QAAA,OAAAD,iBAAA,CACRF,EAAE,CAACS,aAAa;UAAA,IAAAN,SAAA;YAAA,OAAAD,iBAAA,CACdF,EAAE,CAACI,sBAAsB;cACxBC,MAAM,EAAE,gBAAgB;cAAA,IACxBE,IAAIA,CAAA;gBAAA,OAAE,CAAAL,iBAAA,CACHF,EAAE,CAACY,IAAI;kBAACC,OAAO,EAAE;gBAAQ,IAAAX,iBAAA,CACzBF,EAAE,CAACiB,mBAAmB;kBACrBN,IAAI;kBACJO,WAAW,EAAE,EAAE;kBACfC,gBAAgB;gBAAA,IAAAjB,iBAAA,CAEjBF,EAAE,CAACiB,mBAAmB;kBACrBN,IAAI;kBACJO,WAAW,EAAE,IAAI;kBACjBC,gBAAgB;gBAAA,GAEnB;cAAA;YAAA;UAAA;QAAA;MAAA;IAAA,EAIT,CAAC,CAACb,UAAU,CACV;AACN;AACA,KACI,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,183 +1,208 @@
1
1
  import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
2
- import { code, namekey, refkey } from "@alloy-js/core";
3
- import { d } from "@alloy-js/core/testing";
2
+ import { code, namekey, refkey, render } from "@alloy-js/core";
4
3
  import { describe, expect, it } from "vitest";
5
4
  import * as py from "../src/index.js";
6
5
  import { abcModule } from "../src/index.js";
7
- import { assertFileContents, toSourceText, toSourceTextMultiple } from "./utils.js";
6
+ import { TestOutput, TestOutputDirectory } from "./utils.js";
8
7
  describe("Function Declaration", () => {
9
8
  it("renders multiple decorators above def without blank lines", () => {
10
- const result = toSourceText([_$createComponent(py.FunctionDeclaration, {
11
- name: "f",
12
- decorators: ["@a", "@b", "@c"],
13
- children: "pass"
14
- })]);
15
- expect(result).toRenderTo(d`
9
+ expect(_$createComponent(TestOutput, {
10
+ get children() {
11
+ return _$createComponent(py.FunctionDeclaration, {
12
+ name: "f",
13
+ decorators: ["@a", "@b", "@c"],
14
+ children: "pass"
15
+ });
16
+ }
17
+ })).toRenderTo(`
16
18
  @a
17
19
  @b
18
20
  @c
19
21
  def f():
20
22
  pass
21
23
 
22
-
23
24
  `);
24
25
  });
25
26
  it("renders a function with no body as 'pass'", () => {
26
- const result = toSourceText([_$createComponent(py.FunctionDeclaration, {
27
- name: "foo"
28
- })]);
29
- expect(result).toRenderTo(d`
27
+ expect(_$createComponent(TestOutput, {
28
+ get children() {
29
+ return _$createComponent(py.FunctionDeclaration, {
30
+ name: "foo"
31
+ });
32
+ }
33
+ })).toRenderTo(`
30
34
  def foo():
31
35
  pass
32
36
 
33
-
34
37
  `);
35
38
  });
36
39
  it("takes a namekey", () => {
37
- const result = toSourceText([_$createComponent(py.FunctionDeclaration, {
38
- get name() {
39
- return namekey("foo-bar");
40
+ expect(_$createComponent(TestOutput, {
41
+ get children() {
42
+ return _$createComponent(py.FunctionDeclaration, {
43
+ get name() {
44
+ return namekey("foo-bar");
45
+ }
46
+ });
40
47
  }
41
- })]);
42
- expect(result).toRenderTo(d`
48
+ })).toRenderTo(`
43
49
  def foo_bar():
44
50
  pass
45
51
 
46
-
47
52
  `);
48
53
  });
49
54
  it("renders a function with no body as 'pass' with return type", () => {
50
- const result = toSourceText([_$createComponent(py.FunctionDeclaration, {
51
- name: "foo",
52
- returnType: "int"
53
- })]);
54
- expect(result).toRenderTo(d`
55
+ expect(_$createComponent(TestOutput, {
56
+ get children() {
57
+ return _$createComponent(py.FunctionDeclaration, {
58
+ name: "foo",
59
+ returnType: "int"
60
+ });
61
+ }
62
+ })).toRenderTo(`
55
63
  def foo() -> int:
56
64
  pass
57
65
 
58
-
59
66
  `);
60
67
  });
61
68
  it("renders a function that calls another function", () => {
62
69
  const refkeyFoo = refkey();
63
- const result = toSourceText([_$createComponent(py.StatementList, {
70
+ expect(_$createComponent(TestOutput, {
64
71
  get children() {
65
- return [_$createComponent(py.FunctionDeclaration, {
66
- name: "foo",
67
- returnType: "int",
68
- refkey: refkeyFoo
69
- }), _$createComponent(py.FunctionDeclaration, {
70
- name: "bar",
71
- returnType: "int",
72
+ return _$createComponent(py.StatementList, {
72
73
  get children() {
73
- return _$createComponent(py.VariableDeclaration, {
74
- name: "result",
75
- type: "int",
76
- get initializer() {
77
- return _$createComponent(py.FunctionCallExpression, {
78
- target: refkeyFoo,
79
- args: []
74
+ return [_$createComponent(py.FunctionDeclaration, {
75
+ name: "foo",
76
+ returnType: "int",
77
+ refkey: refkeyFoo
78
+ }), _$createComponent(py.FunctionDeclaration, {
79
+ name: "bar",
80
+ returnType: "int",
81
+ get children() {
82
+ return _$createComponent(py.VariableDeclaration, {
83
+ name: "result",
84
+ type: "int",
85
+ get initializer() {
86
+ return _$createComponent(py.FunctionCallExpression, {
87
+ target: refkeyFoo,
88
+ args: []
89
+ });
90
+ }
80
91
  });
81
92
  }
82
- });
93
+ })];
83
94
  }
84
- })];
95
+ });
85
96
  }
86
- })]);
87
- expect(result).toRenderTo(d`
97
+ })).toRenderTo(`
88
98
  def foo() -> int:
89
99
  pass
90
100
 
91
101
  def bar() -> int:
92
102
  result: int = foo()
93
103
 
94
-
95
104
  `);
96
105
  });
97
106
  it("renders a function with parameters", () => {
98
- const result = toSourceText([_$createComponent(py.FunctionDeclaration, {
99
- name: "baz",
100
- parameters: [{
101
- name: "x",
102
- type: "int"
103
- }, {
104
- name: "y",
105
- default: 0
106
- }, {
107
- name: "z",
108
- type: "int",
109
- default: 42
110
- }],
111
- args: true,
112
- kwargs: true,
113
- children: "print(x, y)"
114
- })]);
115
- expect(result).toRenderTo(d`
107
+ expect(_$createComponent(TestOutput, {
108
+ get children() {
109
+ return _$createComponent(py.FunctionDeclaration, {
110
+ name: "baz",
111
+ parameters: [{
112
+ name: "x",
113
+ type: "int"
114
+ }, {
115
+ name: "y",
116
+ default: 0
117
+ }, {
118
+ name: "z",
119
+ type: "int",
120
+ default: 42
121
+ }],
122
+ args: true,
123
+ kwargs: true,
124
+ children: "print(x, y)"
125
+ });
126
+ }
127
+ })).toRenderTo(`
116
128
  def baz(x: int, y=0, z: int = 42, *args, **kwargs):
117
129
  print(x, y)
118
130
 
119
-
120
131
  `);
121
132
  });
122
133
  it("renders an __init__ function with no body as 'pass'", () => {
123
- const result = toSourceText([_$createComponent(py.ClassDeclaration, {
124
- name: "MyClass",
134
+ expect(_$createComponent(TestOutput, {
125
135
  get children() {
126
- return _$createComponent(py.DunderMethodDeclaration, {
127
- name: "__init__",
128
- parameters: [{
129
- name: "x"
130
- }]
136
+ return _$createComponent(py.ClassDeclaration, {
137
+ name: "MyClass",
138
+ get children() {
139
+ return _$createComponent(py.DunderMethodDeclaration, {
140
+ name: "__init__",
141
+ parameters: [{
142
+ name: "x"
143
+ }]
144
+ });
145
+ }
131
146
  });
132
147
  }
133
- })]);
134
- expect(result).toRenderTo(d`
148
+ })).toRenderTo(`
135
149
  class MyClass:
136
150
  def __init__(self, x):
137
151
  pass
138
152
 
139
-
140
-
153
+
141
154
  `);
142
155
  });
143
156
  it("can be an async function", () => {
144
- expect(toSourceText([_$createComponent(py.FunctionDeclaration, {
145
- async: true,
146
- name: "foo"
147
- })])).toBe(d`
157
+ expect(_$createComponent(TestOutput, {
158
+ get children() {
159
+ return _$createComponent(py.FunctionDeclaration, {
160
+ async: true,
161
+ name: "foo"
162
+ });
163
+ }
164
+ })).toRenderTo(`
148
165
  async def foo():
149
166
  pass
150
167
 
151
168
  `);
152
169
  });
153
170
  it("can be an async function with returnType", () => {
154
- expect(toSourceText([_$createComponent(py.FunctionDeclaration, {
155
- async: true,
156
- name: "foo",
157
- returnType: "Foo"
158
- })])).toBe(d`
171
+ expect(_$createComponent(TestOutput, {
172
+ get children() {
173
+ return _$createComponent(py.FunctionDeclaration, {
174
+ async: true,
175
+ name: "foo",
176
+ returnType: "Foo"
177
+ });
178
+ }
179
+ })).toRenderTo(`
159
180
  async def foo() -> Foo:
160
181
  pass
161
182
 
162
183
  `);
163
184
  });
164
185
  it("can be an async function with returnType element with Reference", () => {
165
- expect(toSourceText([_$createComponent(py.StatementList, {
186
+ expect(_$createComponent(TestOutput, {
166
187
  get children() {
167
- return [_$createComponent(py.ClassDeclaration, {
168
- name: "Foo",
169
- get refkey() {
170
- return refkey("Foo");
171
- }
172
- }), _$createComponent(py.FunctionDeclaration, {
173
- async: true,
174
- name: "foo",
175
- get returnType() {
176
- return refkey("Foo");
188
+ return _$createComponent(py.StatementList, {
189
+ get children() {
190
+ return [_$createComponent(py.ClassDeclaration, {
191
+ name: "Foo",
192
+ get refkey() {
193
+ return refkey("Foo");
194
+ }
195
+ }), _$createComponent(py.FunctionDeclaration, {
196
+ async: true,
197
+ name: "foo",
198
+ get returnType() {
199
+ return refkey("Foo");
200
+ }
201
+ })];
177
202
  }
178
- })];
203
+ });
179
204
  }
180
- })])).toBe(d`
205
+ })).toRenderTo(`
181
206
  class Foo:
182
207
  pass
183
208
 
@@ -187,22 +212,26 @@ describe("Function Declaration", () => {
187
212
  `);
188
213
  });
189
214
  it("can be an async function with returnType element with list of References", () => {
190
- expect(toSourceText([_$createComponent(py.StatementList, {
215
+ expect(_$createComponent(TestOutput, {
191
216
  get children() {
192
- return [_$createComponent(py.ClassDeclaration, {
193
- name: "Foo",
194
- get refkey() {
195
- return refkey("Foo");
196
- }
197
- }), _$createComponent(py.FunctionDeclaration, {
198
- async: true,
199
- name: "foo",
200
- get returnType() {
201
- return code`list[${refkey("Foo")}]`;
217
+ return _$createComponent(py.StatementList, {
218
+ get children() {
219
+ return [_$createComponent(py.ClassDeclaration, {
220
+ name: "Foo",
221
+ get refkey() {
222
+ return refkey("Foo");
223
+ }
224
+ }), _$createComponent(py.FunctionDeclaration, {
225
+ async: true,
226
+ name: "foo",
227
+ get returnType() {
228
+ return code`list[${refkey("Foo")}]`;
229
+ }
230
+ })];
202
231
  }
203
- })];
232
+ });
204
233
  }
205
- })])).toBe(d`
234
+ })).toRenderTo(`
206
235
  class Foo:
207
236
  pass
208
237
 
@@ -231,7 +260,9 @@ describe("Function Declaration", () => {
231
260
  });
232
261
  }
233
262
  });
234
- expect(toSourceText([decl])).toBe(d`
263
+ expect(_$createComponent(TestOutput, {
264
+ children: decl
265
+ })).toRenderTo(`
235
266
  class MyClass:
236
267
  async def __aenter__(self) -> MyClass:
237
268
  return self
@@ -258,7 +289,9 @@ describe("Function Declaration", () => {
258
289
  });
259
290
  }
260
291
  });
261
- expect(toSourceText([decl])).toBe(d`
292
+ expect(_$createComponent(TestOutput, {
293
+ children: decl
294
+ })).toRenderTo(`
262
295
  class MyClass:
263
296
  async def __new__(cls) -> MyClass:
264
297
  return super().__new__(cls)
@@ -276,7 +309,9 @@ describe("Function Declaration", () => {
276
309
  }],
277
310
  children: "return a + b"
278
311
  });
279
- expect(toSourceText([decl])).toBe(d`
312
+ expect(_$createComponent(TestOutput, {
313
+ children: decl
314
+ })).toRenderTo(`
280
315
  def foo(a, b):
281
316
  return a + b
282
317
 
@@ -293,7 +328,9 @@ describe("Function Declaration", () => {
293
328
  typeParameters: ["T", "U"],
294
329
  children: "return a + b"
295
330
  });
296
- expect(toSourceText([decl])).toBe(d`
331
+ expect(_$createComponent(TestOutput, {
332
+ children: decl
333
+ })).toRenderTo(`
297
334
  def foo[T, U](a, b):
298
335
  return a + b
299
336
 
@@ -330,9 +367,10 @@ describe("Function Declaration", () => {
330
367
  });
331
368
  }
332
369
  });
333
- expect(toSourceText([decl], {
334
- externals: [abcModule]
335
- })).toBe(d`
370
+ expect(_$createComponent(TestOutput, {
371
+ externals: [abcModule],
372
+ children: decl
373
+ })).toRenderTo(`
336
374
  from abc import abstractmethod
337
375
 
338
376
 
@@ -377,7 +415,9 @@ describe("Function Declaration", () => {
377
415
  });
378
416
  }
379
417
  });
380
- expect(toSourceText([decl])).toBe(d`
418
+ expect(_$createComponent(TestOutput, {
419
+ children: decl
420
+ })).toRenderTo(`
381
421
  class MyClass:
382
422
  def __init__(self, x: int):
383
423
  self.attribute = "value"
@@ -403,7 +443,9 @@ describe("Function Declaration", () => {
403
443
  });
404
444
  }
405
445
  });
406
- expect(toSourceText([decl])).toBe(d`
446
+ expect(_$createComponent(TestOutput, {
447
+ children: decl
448
+ })).toRenderTo(`
407
449
  class MyClass:
408
450
  def __new__(cls, *args, **kwargs):
409
451
  pass
@@ -461,7 +503,9 @@ describe("Function Declaration", () => {
461
503
  })];
462
504
  }
463
505
  });
464
- expect(toSourceText([decl])).toBe(d`
506
+ expect(_$createComponent(TestOutput, {
507
+ children: decl
508
+ })).toRenderTo(`
465
509
  def foo(x: int):
466
510
  def bar(y: int):
467
511
  def foobar(z: int):
@@ -472,55 +516,58 @@ describe("Function Declaration", () => {
472
516
  `);
473
517
  });
474
518
  it("renders complex typing structure", () => {
475
- const res = toSourceTextMultiple([_$createComponent(py.SourceFile, {
476
- path: "mod1.py",
519
+ expect(_$createComponent(TestOutputDirectory, {
477
520
  get children() {
478
- return _$createComponent(py.ClassDeclaration, {
479
- name: "Foo",
480
- get refkey() {
481
- return refkey("Foo");
521
+ return [_$createComponent(py.SourceFile, {
522
+ path: "mod1.py",
523
+ get children() {
524
+ return _$createComponent(py.ClassDeclaration, {
525
+ name: "Foo",
526
+ get refkey() {
527
+ return refkey("Foo");
528
+ }
529
+ });
482
530
  }
483
- });
484
- }
485
- }), _$createComponent(py.SourceFile, {
486
- path: "mod2.py",
487
- get children() {
488
- return [_$createComponent(py.ClassDeclaration, {
489
- name: "A",
490
- get refkey() {
491
- return refkey("A");
531
+ }), _$createComponent(py.SourceFile, {
532
+ path: "mod2.py",
533
+ get children() {
534
+ return [_$createComponent(py.ClassDeclaration, {
535
+ name: "A",
536
+ get refkey() {
537
+ return refkey("A");
538
+ }
539
+ }), _$createComponent(py.ClassDeclaration, {
540
+ name: "B",
541
+ get refkey() {
542
+ return refkey("B");
543
+ }
544
+ })];
492
545
  }
493
- }), _$createComponent(py.ClassDeclaration, {
494
- name: "B",
495
- get refkey() {
496
- return refkey("B");
546
+ }), _$createComponent(py.SourceFile, {
547
+ path: "usage.py",
548
+ get children() {
549
+ return _$createComponent(py.FunctionDeclaration, {
550
+ async: true,
551
+ name: "foo",
552
+ get parameters() {
553
+ return [{
554
+ name: "x",
555
+ type: refkey("A")
556
+ }, {
557
+ name: "y",
558
+ type: refkey("B")
559
+ }];
560
+ },
561
+ args: true,
562
+ kwargs: true,
563
+ get returnType() {
564
+ return refkey("Foo");
565
+ }
566
+ });
497
567
  }
498
568
  })];
499
569
  }
500
- }), _$createComponent(py.SourceFile, {
501
- path: "usage.py",
502
- get children() {
503
- return _$createComponent(py.FunctionDeclaration, {
504
- async: true,
505
- name: "foo",
506
- get parameters() {
507
- return [{
508
- name: "x",
509
- type: refkey("A")
510
- }, {
511
- name: "y",
512
- type: refkey("B")
513
- }];
514
- },
515
- args: true,
516
- kwargs: true,
517
- get returnType() {
518
- return refkey("Foo");
519
- }
520
- });
521
- }
522
- })]);
523
- assertFileContents(res, {
570
+ })).toRenderTo({
524
571
  "mod1.py": `
525
572
  class Foo:
526
573
  pass
@@ -552,37 +599,57 @@ describe("Function Declaration", () => {
552
599
  });
553
600
  it("throws error when PropertyDeclaration is used outside of a class", () => {
554
601
  expect(() => {
555
- toSourceText([_$createComponent(py.PropertyDeclaration, {
556
- name: "x"
557
- })]);
602
+ render(_$createComponent(TestOutput, {
603
+ get children() {
604
+ return _$createComponent(py.PropertyDeclaration, {
605
+ name: "x"
606
+ });
607
+ }
608
+ }));
558
609
  }).toThrow('Method "x" must be declared inside a class (member scope)');
559
610
  });
560
611
  it("throws error when MethodDeclaration is used outside of a class", () => {
561
612
  expect(() => {
562
- toSourceText([_$createComponent(py.MethodDeclaration, {
563
- name: "my_method"
564
- })]);
613
+ render(_$createComponent(TestOutput, {
614
+ get children() {
615
+ return _$createComponent(py.MethodDeclaration, {
616
+ name: "my_method"
617
+ });
618
+ }
619
+ }));
565
620
  }).toThrow('Method "my_method" must be declared inside a class (member scope)');
566
621
  });
567
622
  it("throws error when ClassMethodDeclaration is used outside of a class", () => {
568
623
  expect(() => {
569
- toSourceText([_$createComponent(py.ClassMethodDeclaration, {
570
- name: "my_class_method"
571
- })]);
624
+ render(_$createComponent(TestOutput, {
625
+ get children() {
626
+ return _$createComponent(py.ClassMethodDeclaration, {
627
+ name: "my_class_method"
628
+ });
629
+ }
630
+ }));
572
631
  }).toThrow('Method "my_class_method" must be declared inside a class (member scope)');
573
632
  });
574
633
  it("throws error when StaticMethodDeclaration is used outside of a class", () => {
575
634
  expect(() => {
576
- toSourceText([_$createComponent(py.StaticMethodDeclaration, {
577
- name: "my_static_method"
578
- })]);
635
+ render(_$createComponent(TestOutput, {
636
+ get children() {
637
+ return _$createComponent(py.StaticMethodDeclaration, {
638
+ name: "my_static_method"
639
+ });
640
+ }
641
+ }));
579
642
  }).toThrow('Method "my_static_method" must be declared inside a class (member scope)');
580
643
  });
581
644
  it("throws error when DunderMethodDeclaration is used outside of a class", () => {
582
645
  expect(() => {
583
- toSourceText([_$createComponent(py.DunderMethodDeclaration, {
584
- name: "__init__"
585
- })]);
646
+ render(_$createComponent(TestOutput, {
647
+ get children() {
648
+ return _$createComponent(py.DunderMethodDeclaration, {
649
+ name: "__init__"
650
+ });
651
+ }
652
+ }));
586
653
  }).toThrow('Method "__init__" must be declared inside a class (member scope)');
587
654
  });
588
655
  });