-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OK pour les tests qui valident le calcul de Bmax, tout passe D'UN COUP
- Loading branch information
Showing
4 changed files
with
261 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Tests basés sur le BDD | ||
## Avec [behave](https://behave.readthedocs.io/) | ||
|
||
- Ces fichiers de tests (fichiers `*.features`) viennent de [ce dépôt](https://github.com/JosePaumard/tests-pour-parcoursup). | ||
- Les fichiers en Python utilisent [l'implémentation de ParcourSup.py](../parcoursup). | ||
|
||
## Comment lancer ces tests ? | ||
- Il faut installer le module `behave` : | ||
```bash | ||
$ sudo pip3 install behave | ||
``` | ||
- Et ensuite vous pouvez utiliser le [`Makefile`](Makefile) fournit : | ||
```bash | ||
$ make tests | ||
``` | ||
qui va lancer tous les tests. | ||
|
||
## Exemples | ||
TODO | ||
|
||
## À propos | ||
- Merci à [José Paumard](https://github.com/JosePaumard/) pour cette belle initiative. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
# Copyright (C) 2018 José Paumard | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
@Bmax | ||
Feature: Algorithme de calcul de la position max d'admission d'un internat | ||
Algorithme de calcul de la position maximum d’admission Bmax | ||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 1500 candidats | ||
And un taux d'ouverture de 100 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 300 | | ||
| 2 | 340 | | ||
| 15 | 860 | | ||
| 30 | 1460 | | ||
| 31 | 1500 | | ||
| 45 | 1500 | | ||
| 60 | 1500 | | ||
| 61 | 1500 | | ||
| 65 | 1500 | | ||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 1500 candidats | ||
And un taux d'ouverture de 70 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 300 | | ||
| 2 | 328 | | ||
| 15 | 692 | | ||
| 30 | 1112 | | ||
| 31 | 1140 | | ||
| 45 | 1140 | | ||
| 60 | 1500 | | ||
| 61 | 1500 | | ||
| 65 | 1500 | | ||
|
||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 300 candidats | ||
And un taux d'ouverture de 100 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 300 | | ||
| 2 | 300 | | ||
| 15 | 300 | | ||
| 30 | 300 | | ||
| 31 | 300 | | ||
| 45 | 300 | | ||
| 60 | 300 | | ||
| 61 | 300 | | ||
| 65 | 300 | | ||
|
||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 300 candidats | ||
And un taux d'ouverture de 70 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 300 | | ||
| 2 | 300 | | ||
| 15 | 300 | | ||
| 30 | 300 | | ||
| 31 | 300 | | ||
| 45 | 300 | | ||
| 60 | 300 | | ||
| 61 | 300 | | ||
| 65 | 300 | | ||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 40 candidats | ||
And un taux d'ouverture de 100 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 40 | | ||
| 2 | 40 | | ||
| 15 | 40 | | ||
| 30 | 40 | | ||
| 31 | 40 | | ||
| 45 | 40 | | ||
| 60 | 40 | | ||
| 61 | 40 | | ||
| 65 | 40 | | ||
|
||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 40 candidats | ||
And un taux d'ouverture de 70 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 40 | | ||
| 2 | 40 | | ||
| 15 | 40 | | ||
| 30 | 40 | | ||
| 31 | 40 | | ||
| 45 | 40 | | ||
| 60 | 40 | | ||
| 61 | 40 | | ||
| 65 | 40 | | ||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 299 candidats | ||
And un taux d'ouverture de 100 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 299 | | ||
| 2 | 299 | | ||
| 15 | 299 | | ||
| 30 | 299 | | ||
| 31 | 299 | | ||
| 45 | 299 | | ||
| 60 | 299 | | ||
| 61 | 299 | | ||
| 65 | 299 | | ||
|
||
|
||
Scenario Template: Calcul de Bmax | ||
Given un internat disposant de 300 places | ||
And une liste de 299 candidats | ||
And un taux d'ouverture de 70 | ||
When l'appel est lancé le jour <jour> | ||
Then <candidats> sont appelés | ||
Examples: | ||
| jour | candidats | | ||
| 1 | 299 | | ||
| 2 | 299 | | ||
| 15 | 299 | | ||
| 30 | 299 | | ||
| 31 | 299 | | ||
| 45 | 299 | | ||
| 60 | 299 | | ||
| 61 | 299 | | ||
| 65 | 299 | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf8 -*- | ||
""" Fichier Python qui définit les étapes permettant le test du module ordreappel avec Cucumber et le module behave. | ||
""" | ||
|
||
# --------------------- | ||
# Import des dépendances | ||
from behave import * | ||
|
||
import sys | ||
import os.path | ||
sys.path.insert(0, os.path.join('..', '..')) | ||
|
||
# On importe parcoursup | ||
from parcoursup.ordreappel.VoeuClasse import VoeuClasse | ||
|
||
from parcoursup.propositions.AlgoPropositions import AlgoPropositions | ||
from parcoursup.propositions.GroupeAffectation import GroupeAffectation | ||
from parcoursup.propositions.GroupeAffectationUID import GroupeAffectationUID | ||
from parcoursup.propositions.GroupeInternat import GroupeInternat | ||
from parcoursup.propositions.GroupeInternatUID import GroupeInternatUID | ||
from parcoursup.propositions.VoeuEnAttente import VoeuEnAttente | ||
from parcoursup.propositions.Candidat import Candidat | ||
from parcoursup.propositions.Etablissement import Etablissement | ||
|
||
|
||
# --------------------- | ||
# On définit les fonctions utilitaires | ||
|
||
from ordreappel_steps import candidat2VoeuClasse, VoeuClasse2candidat | ||
|
||
|
||
# --------------------- | ||
# On définit les étapes | ||
|
||
@given("un internat disposant de {L:d} places") | ||
def step_impl(context, L): | ||
context.L = L | ||
|
||
@given("une liste de {M:d} candidats") | ||
def step_impl(context, M): | ||
context.M = M | ||
|
||
@given("un taux d'ouverture de {ouverture:d}") | ||
def step_impl(context, ouverture): | ||
context.ouverture = ouverture | ||
|
||
@when("l'appel est lancé le jour {jour:d}") | ||
def step_impl(context, jour): | ||
context.jour = jour | ||
groupeInternatUID = GroupeInternatUID(1, 1) | ||
groupeInternat = GroupeInternat(groupeInternatUID, context.L, context.ouverture) | ||
bmax = groupeInternat.calculeAssietteAdmission(context.M, context.L, context.jour, context.ouverture) | ||
context.bmax = bmax | ||
|
||
@then("{candidats:d} sont appelés") | ||
def step_impl(context, candidats): | ||
assert context.bmax == candidats |