Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
HURE GABRIELLE
qui-est-ce
Commits
621e3f89
Commit
621e3f89
authored
May 23, 2020
by
MACHADO-VICENTE MICKAEL
Browse files
Ajouts des vrais tags + modifications du code en conséquence
parent
2b929a52
Changes
6
Hide whitespace changes
Inline
Side-by-side
data/base_donees.xlsx
View file @
621e3f89
No preview for this file type
lecteur_bd.py
View file @
621e3f89
...
...
@@ -77,7 +77,7 @@ class LecteurBd:
if
idx_col
>=
1
:
dict_questions_reponse
[
db_personnages
.
columns
.
values
[
idx_col
]]
=
valeur
# ajout du Personnage créé dans la liste
liste_personnage
.
append
(
Personnage
(
numero
=
idx_ligne
,
tag
=
ligne
[
0
],
dict_questions_reponse
=
dict_questions_reponse
))
liste_personnage
.
append
(
Personnage
(
numero
=
idx_ligne
,
tag
=
ligne
.
iloc
[
0
],
dict_questions_reponse
=
dict_questions_reponse
))
return
liste_personnage
...
...
main.py
View file @
621e3f89
...
...
@@ -23,15 +23,15 @@ lecteur_bd = LecteurBd(chemin_bd)
Creation liste de capteurs et tags lus comme exemple
"""
tag_faux
=
[
"
0001q"
,
"0002q"
,
"0001p"
,
"0003q"
,
"0002p"
,
"0004q"
,
"0003p
"
,
"0004p"
,
"0005q"
,
""
,
""
,
"0007q"
,
"0006p"
,
"0008q"
,
"0007p
"
]
tag_juste
=
[
"
0001q"
,
"0004q"
,
"0006q"
,
"0002q"
,
"0005q"
,
"0007q"
,
"0008q
"
,
"0001p"
,
"0002p"
,
"0003p"
,
"0004p"
,
"0005p"
,
"0006p"
,
"0007p"
,
"0008p
"
]
tag_faux
=
[
"
1631131625874"
,
"422003312207"
,
"154814212237"
,
"24721722656244"
,
"1515323556113"
,
"21517614058209"
,
"1671142045633
"
,
"19913424456141"
,
"874124856190"
,
""
,
""
,
"711704057252"
,
"1831092485626"
,
"231468758232"
,
"2021444312125
"
]
tag_juste
=
[
"
1631131625874"
,
"21517614058209"
,
"218381011253"
,
"422003312207"
,
"874124856190"
,
"711704057252"
,
"231468758232
"
,
"154814212237"
,
"1515323556113"
,
"1671142045633"
,
"19913424456141"
,
"1351587057102"
,
"1831092485626"
,
"2021444312125"
,
"19912824156142
"
]
capteurs
=
[]
for
i
in
range
(
1
,
16
):
capteurs
.
append
(
Capteur
(
i
,
tag_
faux
[
i
-
1
]))
capteurs
.
append
(
Capteur
(
i
,
tag_
juste
[
i
-
1
]))
"""
Test de la vérification
...
...
tests/test_unitaire_capteur.py
View file @
621e3f89
...
...
@@ -7,14 +7,14 @@ import re
class
TestCapteur
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tag_juste
=
[
"
0001q"
,
"0004q"
,
"0006q"
,
"0002q"
,
"0005q"
,
"0007q"
,
"0008q
"
,
"
0001p"
,
"0002p"
,
"0003p"
,
"0004p"
,
"0005p"
,
"0006p"
,
"0007p"
,
"0008p
"
]
self
.
tag_juste
=
[
"
1631131625874"
,
"21517614058209"
,
"218381011253"
,
"422003312207"
,
"874124856190"
,
"711704057252"
,
"231468758232
"
,
"
154814212237"
,
"1515323556113"
,
"1671142045633"
,
"19913424456141"
,
"1351587057102"
,
"1831092485626"
,
"2021444312125"
,
"19912824156142
"
]
def
test_capteur
(
self
):
capteur
=
Capteur
(
1
,
self
.
tag_juste
[
0
])
self
.
assertIsInstance
(
capteur
,
(
Capteur
))
self
.
assertEqual
(
capteur
.
numero_capteur
,
1
)
self
.
assertEqual
(
capteur
.
tag_lu
,
'
0001q
'
)
self
.
assertEqual
(
capteur
.
tag_lu
,
'
1631131625874
'
)
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
tests/test_unitaire_verification_elements.py
View file @
621e3f89
...
...
@@ -11,11 +11,11 @@ class TestVerificationElements(unittest.TestCase):
self
.
chemin_bd
=
Path
(
os
.
getcwd
()).
joinpath
(
"data/base_donees.xlsx"
)
self
.
lecteur_bd
=
LecteurBd
(
self
.
chemin_bd
)
self
.
tag_faux
=
[
"
0001q"
,
"0002q"
,
"0001p"
,
"0003q"
,
"0002p"
,
"0004q"
,
"0003p
"
,
"
0004p"
,
"0005q"
,
""
,
""
,
"0007q"
,
"0006p"
,
"0008q"
,
"0007p
"
]
self
.
tag_faux
=
[
"
1631131625874"
,
"422003312207"
,
"154814212237"
,
"24721722656244"
,
"1515323556113"
,
"21517614058209"
,
"1671142045633
"
,
"
19913424456141"
,
"874124856190"
,
""
,
""
,
"711704057252"
,
"1831092485626"
,
"231468758232"
,
"2021444312125
"
]
self
.
tag_juste
=
[
"
0001q"
,
"0004q"
,
"0006q"
,
"0002q"
,
"0005q"
,
"0007q"
,
"0008q
"
,
"
0001p"
,
"0002p"
,
"0003p"
,
"0004p"
,
"0005p"
,
"0006p"
,
"0007p"
,
"0008p
"
]
self
.
tag_juste
=
[
"
1631131625874"
,
"21517614058209"
,
"218381011253"
,
"422003312207"
,
"874124856190"
,
"711704057252"
,
"231468758232
"
,
"
154814212237"
,
"1515323556113"
,
"1671142045633"
,
"19913424456141"
,
"1351587057102"
,
"1831092485626"
,
"2021444312125"
,
"19912824156142
"
]
self
.
capteurs_faux
=
[]
self
.
capteurs_juste
=
[]
...
...
verification_elements.py
View file @
621e3f89
...
...
@@ -63,14 +63,14 @@ class VerificationElements:
trouve
=
False
# initialisation tag non trouvée dans la liste des Personnages et des Questions.
tag
=
capteur
.
tag_lu
for
question
in
self
.
liste_questions
:
# recherche du tag lu dans la liste des Questions
if
tag
==
question
.
tag
:
if
tag
==
str
(
question
.
tag
)
:
liste_objects_lus
.
append
(
question
)
liste_index_question
.
append
(
index
)
trouve
=
True
break
if
not
trouve
:
# si le tag n'est pas trouvé dans la liste des Questions
for
personnage
in
self
.
liste_personnages
:
# recherche du tag lu dans la liste des Personnages
if
tag
==
personnage
.
tag
:
if
tag
==
str
(
personnage
.
tag
)
:
liste_objects_lus
.
append
(
personnage
)
liste_index_personnage
.
append
(
index
)
trouve
=
True
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment