Title: check_function inside for loop can't find aliases outside · Issue #353 · datacamp/pythonwhat · GitHub
Open Graph Title: check_function inside for loop can't find aliases outside · Issue #353 · datacamp/pythonwhat
X Title: check_function inside for loop can't find aliases outside · Issue #353 · datacamp/pythonwhat
Description: The following works fine: # solution import numpy as np np.random.randint(1, 7) # sct Ex().check_function('numpy.random.randint') The following does not: # solution import numpy as np for x in range(0): np.random.randint(1, 7) # sct Ex()...
Open Graph Description: The following works fine: # solution import numpy as np np.random.randint(1, 7) # sct Ex().check_function('numpy.random.randint') The following does not: # solution import numpy as np for x in rang...
X Description: The following works fine: # solution import numpy as np np.random.randint(1, 7) # sct Ex().check_function('numpy.random.randint') The following does not: # solution import numpy as np for x...
Opengraph URL: https://github.com/datacamp/pythonwhat/issues/353
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"check_function inside for loop can't find aliases outside","articleBody":"The following works fine:\r\n\r\n```python\r\n# solution\r\nimport numpy as np\r\nnp.random.randint(1, 7)\r\n\r\n# sct\r\nEx().check_function('numpy.random.randint')\r\n```\r\n\r\nThe following does not:\r\n\r\n```python\r\n# solution\r\nimport numpy as np\r\nfor x in range(0):\r\n np.random.randint(1, 7)\r\n\r\n# sct\r\nEx().check_for_loop().check_body().check_function('numpy.random.randint')\r\n```\r\n\r\nThis is because the mappings of aliases onto their modules are figured out on a per-state basis (instead of once, on the root).\r\n\r\nThere's a failing test (with the `xfail` mark) [here](https://github.com/datacamp/pythonwhat/commit/2232d4e41f4fd468628f39c1d301eb080e0f3351).\r\n\r\nThis is a pretty big bug!!!","author":{"url":"https://github.com/filipsch","@type":"Person","name":"filipsch"},"datePublished":"2018-09-14T14:41:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/353/pythonwhat/issues/353"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:28fa3557-a67a-8e00-8e5b-63a857e61f4c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E762:A1401:7A9CADC:A48AC36:698CDCB2 |
| html-safe-nonce | ebe85f27f172ad2effd606e8f48ef1a5b883e222dc350fd13be8b576df543fea |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNzYyOkExNDAxOjdBOUNBREM6QTQ4QUMzNjo2OThDRENCMiIsInZpc2l0b3JfaWQiOiIxMDM4MjA4MTY5NzYxNjI3MzE0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 57ac9ac99d9de6d1df2abc660f28948c4d782265d1ccca4f129125995d33a2ca |
| hovercard-subject-tag | issue:360333347 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/datacamp/pythonwhat/353/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14f4b69eed15a956b066fcf0bc7433775cdfab56e3d5d4665ddaeb078b2cd005/datacamp/pythonwhat/issues/353 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14f4b69eed15a956b066fcf0bc7433775cdfab56e3d5d4665ddaeb078b2cd005/datacamp/pythonwhat/issues/353 |
| og:image:alt | The following works fine: # solution import numpy as np np.random.randint(1, 7) # sct Ex().check_function('numpy.random.randint') The following does not: # solution import numpy as np for x in rang... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | filipsch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4 |
| turbo-cache-control | no-preview |
| go-import | github.com/datacamp/pythonwhat git https://github.com/datacamp/pythonwhat.git |
| octolytics-dimension-user_id | 6276968 |
| octolytics-dimension-user_login | datacamp |
| octolytics-dimension-repository_id | 51361383 |
| octolytics-dimension-repository_nwo | datacamp/pythonwhat |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 51361383 |
| octolytics-dimension-repository_network_root_nwo | datacamp/pythonwhat |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3d444f0a47beeeac94cddbb51c91ab408befe8d4 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width