@@ -1184,11 +1184,7 @@ assert(mocked.find('.greeting').length === 1);
11841184 type : "python" ,
11851185 source,
11861186 } ) ;
1187- return runner ?. runTest (
1188- `({
1189- test: () => assert.equal(runPython('get_five()'), 5),
1190- })` ,
1191- ) ;
1187+ return runner ?. runTest ( `assert.equal(runPython('get_five()'), 5)` ) ;
11921188 } , source ) ;
11931189
11941190 expect ( result ) . toEqual ( { pass : true } ) ;
@@ -1207,11 +1203,7 @@ test: () => assert.equal(runPython('get_five()'), 5),
12071203 const result = await page . evaluate ( async ( ) => {
12081204 const runner = window . FCCTestRunner . getRunner ( "python" ) ;
12091205 await runner ?. init ( { } , 1000 ) ;
1210- return runner ?. runTest (
1211- `({
1212- test: () => assert.equal(runPython('get_five()'), 5),
1213- })` ,
1214- ) ;
1206+ return runner ?. runTest ( `assert.equal(runPython('get_five()'), 5)` ) ;
12151207 } ) ;
12161208
12171209 expect ( result ) . toMatchObject ( {
@@ -1230,9 +1222,7 @@ test: () => assert.equal(runPython('get_five()'), 5),
12301222 type : "python" ,
12311223 } ) ;
12321224 return runner ?. runTest (
1233- `({
1234- test: () => assert.equal(runPython('__name__'), '__main__'),
1235- })` ,
1225+ `assert.equal(runPython('__name__'), '__main__')` ,
12361226 ) ;
12371227 } ) ;
12381228
@@ -1263,45 +1253,6 @@ test: () => assert.equal(runPython('__name__'), '__main__'),
12631253 } ) ;
12641254 } ) ;
12651255
1266- it ( "should reject testStrings that evaluate to an invalid object" , async ( ) => {
1267- const result = await page . evaluate ( async ( ) => {
1268- const runner = await window . FCCTestRunner . createTestRunner ( {
1269- type : "python" ,
1270- } ) ;
1271- return runner ?. runTest ( `({ invalid: 'test' })` ) ;
1272- } ) ;
1273-
1274- expect ( result ) . toEqual ( {
1275- err : {
1276- message :
1277- "Test string did not evaluate to an object with the 'test' property" ,
1278- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
1279- stack : expect . stringContaining (
1280- "Error: Test string did not evaluate to an object with the 'test' property" ,
1281- ) ,
1282- } ,
1283- } ) ;
1284- } ) ;
1285-
1286- it ( "should be able to test with mock input" , async ( ) => {
1287- const result = await page . evaluate ( async ( ) => {
1288- const runner = await window . FCCTestRunner . createTestRunner ( {
1289- type : "python" ,
1290- source : `
1291- first = input()
1292- second = input()
1293- ` ,
1294- } ) ;
1295-
1296- return runner ?. runTest ( `({
1297- input: ["argle", "bargle"],
1298- test: () => assert.equal(runPython('first + second'), "arglebargle")
1299- })` ) ;
1300- } ) ;
1301-
1302- expect ( result ) . toEqual ( { pass : true } ) ;
1303- } ) ;
1304-
13051256 it ( "should make user code available to the python code as the _code variable" , async ( ) => {
13061257 const result = await page . evaluate ( async ( ) => {
13071258 const runner = await window . FCCTestRunner . createTestRunner ( {
@@ -1311,9 +1262,9 @@ second = input()
13111262 } ,
13121263 } ) ;
13131264
1314- return runner ?. runTest ( `({
1315- test: () => assert.equal(runPython('_code'), "test = 'value'")
1316- })` ) ;
1265+ return runner ?. runTest (
1266+ ` assert.equal(runPython('_code'), "test = 'value'")` ,
1267+ ) ;
13171268 } ) ;
13181269
13191270 expect ( result ) . toEqual ( { pass : true } ) ;
@@ -1324,9 +1275,9 @@ second = input()
13241275 const runner = await window . FCCTestRunner . createTestRunner ( {
13251276 type : "python" ,
13261277 } ) ;
1327- return runner ?. runTest ( `({
1328- test: () => assert.equal(runPython('_Node("x = 1").get_variable("x")'), 1)
1329- })` ) ;
1278+ return runner ?. runTest (
1279+ ` assert.equal(runPython('_Node("x = 1").get_variable("x")'), 1)` ,
1280+ ) ;
13301281 } ) ;
13311282
13321283 expect ( result ) . toEqual ( { pass : true } ) ;
@@ -1344,9 +1295,7 @@ second = input()
13441295 } ,
13451296 } ) ;
13461297
1347- return runner ?. runTest ( `({
1348- test: () => {}
1349- })` ) ;
1298+ return runner ?. runTest ( "" ) ;
13501299 } ) ;
13511300
13521301 expect ( result ) . toEqual ( { pass : true } ) ;
@@ -1372,9 +1321,7 @@ second = input()
13721321 const runner = await window . FCCTestRunner . createTestRunner ( {
13731322 type : "python" ,
13741323 } ) ;
1375- return runner ?. runTest ( `({
1376- test: () => assert.equal(runPython('1 + "1"'), 2)
1377- })` ) ;
1324+ return runner ?. runTest ( `assert.equal(runPython('1 + "1"'), 2)` ) ;
13781325 } ) ;
13791326 expect ( result ) . toEqual ( {
13801327 err : {
@@ -1400,9 +1347,7 @@ pattern = re.compile('l+')
14001347 type : "python" ,
14011348 source,
14021349 } ) ;
1403- return runner ?. runTest ( `({
1404- test: () => assert.equal(runPython('str(pattern)'), "l+")
1405- })` ) ;
1350+ return runner ?. runTest ( `assert.equal(runPython('str(pattern)'), "l+")` ) ;
14061351 } , source ) ;
14071352 expect ( result ) . toEqual ( {
14081353 err : {
@@ -1429,9 +1374,9 @@ pattern = re.compile('l+')`;
14291374 } ) ;
14301375 // Since the comparison includes a PyProxy object, that will be
14311376 // posted back to the caller and cause a DataCloneError
1432- return runner ?. runTest ( `
1433- ({ test: () => assert.equal(__userGlobals.get("pattern"), "l+") })
1434- ` ) ;
1377+ return runner ?. runTest (
1378+ ` assert.equal(__userGlobals.get("pattern"), "l+")` ,
1379+ ) ;
14351380 } , source ) ;
14361381
14371382 expect ( result ) . toEqual ( {
@@ -1476,7 +1421,7 @@ pattern = re.compile('l+')`;
14761421 } ) ;
14771422 } ) ;
14781423
1479- it ( "should use a fake input function in simple tests " , async ( ) => {
1424+ it ( "should not throw when input is called during a test " , async ( ) => {
14801425 const result = await page . evaluate ( async ( ) => {
14811426 const runner = await window . FCCTestRunner . createTestRunner ( {
14821427 type : "python" ,
0 commit comments