Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
redsem
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mauricio Alejandro Prieto Palacios
redsem
Commits
fe9cb774
Commit
fe9cb774
authored
Feb 07, 2023
by
alejandro77palacios
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test: primera prueba, fixtures y parametrización
parent
a1f673e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
test/test_main.py
+37
-0
No files found.
test/test_main.py
0 → 100644
View file @
fe9cb774
import
networkx
as
nx
import
pandas
as
pd
import
pytest
from
redsem
import
main
@pytest.fixture
()
def
df_prueba
():
datos
=
{
'palabras'
:
[
'prueba'
,
'para'
,
'redes'
,
'semánticas'
],
'posicion'
:
[
1
,
2
,
3
,
4
]}
return
pd
.
DataFrame
(
datos
)
@pytest.fixture
()
def
red_prueba
():
palabras_estimulo
=
[
'covid_semilla'
,
'obesidad_semilla'
]
palabras_respuesta
=
[
'salud'
,
'ansiedad'
,
'higiene'
,
'comida'
]
aristas
=
[
(
'covid_semilla'
,
'salud'
),
(
'covid_semilla'
,
'ansiedad'
),
(
'covid_semilla'
,
'higiene'
),
(
'obesidad_semilla'
,
'salud'
),
(
'obesidad_semilla'
,
'ansiedad'
),
(
'obesidad_semilla'
,
'comida'
)
]
red
=
nx
.
Graph
()
red
.
add_edges_from
(
aristas
)
particion_bipartita
=
{
palabra
:
'estimulo'
for
palabra
in
palabras_estimulo
}
particion_bipartita
|=
{
palabra
:
'respuesta'
for
palabra
in
palabras_respuesta
}
nx
.
set_node_attributes
(
red
,
'bipartita'
,
particion_bipartita
)
return
red
@pytest.mark.parametrize
(
"ultima"
,
[
1
,
2
,
3
,
4
])
def
test_filtrado_correcto
(
df_prueba
,
ultima
):
df_filtrado
=
main
.
filtrar_primeras_posiciones
(
df_prueba
,
ultima_posicion
=
ultima
)
assert
len
(
df_filtrado
)
==
ultima
Write
Preview
Markdown
is supported
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