{"id":25944590,"url":"https://github.com/swyth-dev/technical-interview-apprentices-main","last_synced_at":"2026-06-05T12:31:35.239Z","repository":{"id":189880439,"uuid":"531632892","full_name":"swyth-dev/technical-interview-apprentices-main","owner":"swyth-dev","description":"The aim of the first part in this technical test is to implement sound unit-testing for a small toy project. ","archived":false,"fork":false,"pushed_at":"2022-09-04T14:50:41.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T12:40:45.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swyth-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-09-01T18:05:33.000Z","updated_at":"2023-03-17T13:13:23.000Z","dependencies_parsed_at":"2023-08-22T07:23:12.953Z","dependency_job_id":"5cd032f7-b115-42eb-b2d2-a576c9205e3d","html_url":"https://github.com/swyth-dev/technical-interview-apprentices-main","commit_stats":null,"previous_names":["agent-swyth/technical-interview-apprentices-main","swyth-dev/technical-interview-apprentices-main"],"tags_count":null,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyth-dev%2Ftechnical-interview-apprentices-main","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyth-dev%2Ftechnical-interview-apprentices-main/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyth-dev%2Ftechnical-interview-apprentices-main/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swyth-dev%2Ftechnical-interview-apprentices-main/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swyth-dev","download_url":"https://codeload.github.com/swyth-dev/technical-interview-apprentices-main/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241809607,"owners_count":20023787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-04T08:18:22.166Z","updated_at":"2026-06-05T12:31:35.227Z","avatar_url":"https://github.com/swyth-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# technical-interview-apprentices\n\nYou will find the resources needed for this technical test in this archive. We expect you to provide the results as a GitHub repository. \n\n*Hint*: you can begin by creating the repo with this archive content. \n*Hint*: Don't hesitate to ask question, don't worry if something doesn't work and, keep it simple :).  \n*Hint*: code enhancement propositions are welcome. \n\n\n## school-management\n\nThe aim of the first part in this technical test is to implement sound unit-testing for a small toy project. \n\n**Your mission** is to help the school have a reliable library to compute student's grade at the end of semesters and automate *passes to next year* decisions. To do that, you are in charge of unit testing. \n\nA student passes a semester if its global mark exceeds a threshold (10). The global mark is computed as the weighted mean of the student's grades in all topics (classes). For instance, if the topic weights for a group `A` are (mathematics : 10, physics: 8, geography: 2) and if student `Alice` of group `A` obtains 13 in mathematics, 12 in physics and 18 in geometry, its global mark is obtained by: (13 x 10 + 12 x 8 + 18 x 2) / (1 x 10 + 1 x 8 + 1 x 2).  \n\n**set-up and structure**\nYou can find the python project in `school-management` folder . We use `poetry` to initialize it. `poetry` is a tool for dependency management and packaging for `Python projects. **Your first task** is to install poetry on your computer and install the project's dependencies. For that, you need to follow the instructions in the documentation: https://python-poetry.org/docs/\n\nWhen `poetry` is installed, you can run `make install` at the `school-management` folder to install the project's dependencies. \n\nAs you can remark, the `school-management` project is composed by: \n- A `src` folder containing the sources of the library. The source code is within `src/school-management` that contains two modules:\n    - **models** containing classes permitting to describe a class group.\n    - **computations** containing modules devised to computations.\n- A `test` folder containing unit tests. We will use `pytest` for this library as a testing framework. \n\nIf you had set up `poetry` and correctly installed the dependencies, you can run unit tests by executing `poetry run pytest` at the project root. You will remark that there are two tests. One for `compute_student_topic_grades_mean`, marked as skipped (it is not implemented) and the other for `compute_group_grades` that is not passing. \n\n- `compute_student_topic_grades_mean` computes the a student's average mark for a given topic. Unfortunately, the developer hasn't implemented the unit test. **Your second task** is to implement **sound** unit tests for this function. Furthermore, we know this function is not robust due to some crashes during execution. **Your third task** is to cover some of its vulnerabilities in the unit test and enhance the function implementation. \n- `compute_group_grades` takes a `Group` object (you can find this class in `src/school-management/models/school.py`) and computes a global mark and a boolean stating that the students pass the semester. This test for this function is not successful. **Your task** is to discover why and fix the function. (Bonus: you enhance the testing with other use cases) \n\n(Bonus task) As you may have noticed, the models in `src/school-management/models/school.py` use `pydantic` to define Models. `pydantic` is a library devised for data validation using Python type annotation (https://pydantic-docs.helpmanual.io/). For instance, if a base model, `MyModel`, has a positive integer parameter `number: PositiveInt`, `pydantic` will check its type during instantiation. If one writes `MyModel(number= \"string\")`, `pydantic` raises a `ValidationError` stating that parameter `number` is not well typed. As you can see, `compute_group_grades` returns a dictionary containing the necessary caution. Can you come up with a class, a BaseModel, for this function's results? (i.e. a class containing the necessary parameters for the function's results.) You can take inspiration from the already implemented BaseModels. \n\n(Bonus task) Can you amend the `Makefile` file to run:\n- `make pytest` to run tests. Reminder: you can run pytest tests executing `poetry run pytest` in your terminal.\n- `make hard-install` to have a fresh install of the library (i.e., delete the local virtual environment (i.e., delete the `.venv` folder) and then install dependencies using poetry. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswyth-dev%2Ftechnical-interview-apprentices-main","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswyth-dev%2Ftechnical-interview-apprentices-main","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswyth-dev%2Ftechnical-interview-apprentices-main/lists"}