Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
haskell-gargantext
Commits
be58a6ac
Commit
be58a6ac
authored
Feb 26, 2024
by
Alfredo Di Napoli
Committed by
Alfredo Di Napoli
Mar 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add toPhyloWithoutLink test coverage
parent
ac11395a
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
646 additions
and
4 deletions
+646
-4
gargantext.cabal
gargantext.cabal
+8
-1
small-phylo.golden.json
test-data/phylo/small-phylo.golden.json
+1
-0
small_phylo_docslist.csv
test-data/phylo/small_phylo_docslist.csv
+10
-0
small_phylo_ngramslist.csv
test-data/phylo/small_phylo_ngramslist.csv
+583
-0
Phylo.hs
test/Test/Offline/Phylo.hs
+44
-3
No files found.
gargantext.cabal
View file @
be58a6ac
...
@@ -38,6 +38,9 @@ data-files:
...
@@ -38,6 +38,9 @@ data-files:
test-data/phylo/bpa_phylo_test.json
test-data/phylo/bpa_phylo_test.json
test-data/phylo/open_science.json
test-data/phylo/open_science.json
test-data/phylo/issue-290-small.golden.json
test-data/phylo/issue-290-small.golden.json
test-data/phylo/small-phylo.golden.json
test-data/phylo/small_phylo_docslist.csv
test-data/phylo/small_phylo_ngramslist.csv
test-data/stemming/lancaster.txt
test-data/stemming/lancaster.txt
test-data/test_config.ini
test-data/test_config.ini
gargantext-cors-settings.toml
gargantext-cors-settings.toml
...
@@ -843,6 +846,7 @@ test-suite garg-test-tasty
...
@@ -843,6 +846,7 @@ test-suite garg-test-tasty
main-is: drivers/tasty/Main.hs
main-is: drivers/tasty/Main.hs
other-modules:
other-modules:
Test.API.Routes
Test.API.Routes
Common
Test.API.Setup
Test.API.Setup
Test.Core.Similarity
Test.Core.Similarity
Test.Core.Text
Test.Core.Text
...
@@ -878,7 +882,7 @@ test-suite garg-test-tasty
...
@@ -878,7 +882,7 @@ test-suite garg-test-tasty
Test.Utils.Jobs
Test.Utils.Jobs
Paths_gargantext
Paths_gargantext
hs-source-dirs:
hs-source-dirs:
test
test
bin/gargantext-phylo/Phylo
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
build-depends:
build-depends:
QuickCheck ^>= 2.14.2
QuickCheck ^>= 2.14.2
...
@@ -891,6 +895,8 @@ test-suite garg-test-tasty
...
@@ -891,6 +895,8 @@ test-suite garg-test-tasty
, conduit ^>= 1.3.4.2
, conduit ^>= 1.3.4.2
, containers ^>= 0.6.5.1
, containers ^>= 0.6.5.1
, crawlerArxiv
, crawlerArxiv
, cryptohash
, directory
, duckling ^>= 0.2.0.0
, duckling ^>= 0.2.0.0
, extra ^>= 1.7.9
, extra ^>= 1.7.9
, fast-logger ^>= 3.0.5
, fast-logger ^>= 3.0.5
...
@@ -931,6 +937,7 @@ test-suite garg-test-tasty
...
@@ -931,6 +937,7 @@ test-suite garg-test-tasty
, servant-server
, servant-server
, shelly >= 1.9 && < 2
, shelly >= 1.9 && < 2
, stm ^>= 2.5.0.1
, stm ^>= 2.5.0.1
, split
, tasty ^>= 1.4.2.1
, tasty ^>= 1.4.2.1
, tasty-golden
, tasty-golden
, tasty-hspec
, tasty-hspec
...
...
test-data/phylo/small-phylo.golden.json
0 → 100644
View file @
be58a6ac
This diff is collapsed.
Click to expand it.
test-data/phylo/small_phylo_docslist.csv
0 → 100644
View file @
be58a6ac
This diff is collapsed.
Click to expand it.
test-data/phylo/small_phylo_ngramslist.csv
0 → 100644
View file @
be58a6ac
This diff is collapsed.
Click to expand it.
test/Test/Offline/Phylo.hs
View file @
be58a6ac
...
@@ -5,19 +5,21 @@
...
@@ -5,19 +5,21 @@
module
Test.Offline.Phylo
(
tests
)
where
module
Test.Offline.Phylo
(
tests
)
where
import
Data.Aeson
import
Data.GraphViz.Attributes.Complete
qualified
as
Graphviz
import
Data.GraphViz.Attributes.Complete
qualified
as
Graphviz
import
Data.Text.Lazy
as
TL
import
Data.Vector
qualified
as
V
import
Data.Vector
qualified
as
V
import
Gargantext.Core.Viz.Phylo
import
Gargantext.Core.Viz.Phylo
import
Gargantext.Core.Viz.Phylo.API.Tools
(
readPhylo
,
writePhylo
)
import
Gargantext.Core.Viz.Phylo.API.Tools
(
readPhylo
,
writePhylo
)
import
Gargantext.Core.Viz.Phylo.PhyloExport
import
Gargantext.Core.Viz.Phylo.PhyloExport
import
Gargantext.Core.Viz.Phylo.PhyloMaker
(
toPhylo
)
import
Gargantext.Core.Viz.Phylo.PhyloMaker
(
toPhylo
,
toPhyloWithoutLink
)
import
Gargantext.Core.Viz.Phylo.PhyloTools
import
Gargantext.Core.Viz.Phylo.PhyloTools
import
Prelude
import
Prelude
import
Test.Tasty
import
Test.Tasty
import
Test.Tasty.HUnit
import
Test.Tasty.HUnit
import
Test.Tasty.QuickCheck
import
Test.Tasty.QuickCheck
import
Data.Text.Lazy
as
TL
import
Common
import
Paths_gargantext
import
Paths_gargantext
phyloConfig
::
PhyloConfig
phyloConfig
::
PhyloConfig
...
@@ -46,12 +48,37 @@ phyloConfig = PhyloConfig {
...
@@ -46,12 +48,37 @@ phyloConfig = PhyloConfig {
tests
::
TestTree
tests
::
TestTree
tests
=
testGroup
"Phylo"
[
tests
=
testGroup
"Phylo"
[
-- testCase "returns expected data" testSmallPhyloExpectedOutput
testGroup
"Export"
[
testGroup
"Export"
[
testCase
"ngramsToLabel respects encoding"
test_ngramsToLabel_01
testCase
"ngramsToLabel respects encoding"
test_ngramsToLabel_01
,
testCase
"ngramsToLabel is rendered correctly in CustomAttribute"
test_ngramsToLabel_02
,
testCase
"ngramsToLabel is rendered correctly in CustomAttribute"
test_ngramsToLabel_02
]
]
,
testGroup
"toPhyloWithoutLink"
[
testCase
"returns expected data"
testSmallPhyloWithoutLinkExpectedOutput
]
,
testGroup
"toPhylo"
[
testCase
"returns expected data"
testSmallPhyloExpectedOutput
]
,
testGroup
"relatedComponents"
[
testCase
"finds simple connection"
testRelComp_Connected
]
]
]
testSmallPhyloWithoutLinkExpectedOutput
::
Assertion
testSmallPhyloWithoutLinkExpectedOutput
=
do
bpaConfig
<-
getDataFileName
"bench-data/phylo/bpa-config.json"
corpusPath'
<-
getDataFileName
"test-data/phylo/small_phylo_docslist.csv"
listPath'
<-
getDataFileName
"test-data/phylo/small_phylo_ngramslist.csv"
(
Right
config
)
<-
fmap
(
\
pcfg
->
pcfg
{
corpusPath
=
corpusPath'
,
listPath
=
listPath'
})
<$>
(
eitherDecodeFileStrict'
bpaConfig
)
mapList
<-
fileToList
(
listParser
config
)
(
listPath
config
)
corpus
<-
fileToDocsDefault
(
corpusParser
config
)
(
corpusPath
config
)
[
Year
3
1
5
,
Month
3
1
5
,
Week
4
2
5
]
mapList
actual
<-
pure
$
toPhyloWithoutLink
corpus
config
expected
<-
readPhylo
=<<
getDataFileName
"test-data/phylo/small-phylo.golden.json"
expected
@?=
actual
testSmallPhyloExpectedOutput
::
Assertion
testSmallPhyloExpectedOutput
::
Assertion
testSmallPhyloExpectedOutput
=
do
testSmallPhyloExpectedOutput
=
do
...
@@ -69,3 +96,17 @@ test_ngramsToLabel_02 :: Assertion
...
@@ -69,3 +96,17 @@ test_ngramsToLabel_02 :: Assertion
test_ngramsToLabel_02
=
test_ngramsToLabel_02
=
let
ngrams
=
V
.
fromList
[
"钱"
,
"狗"
]
let
ngrams
=
V
.
fromList
[
"钱"
,
"狗"
]
in
(
Graphviz
.
customValue
$
toAttr
"lbl"
$
TL
.
fromStrict
$
ngramsToLabel
ngrams
[
0
,
1
])
@?=
"钱 | 狗"
in
(
Graphviz
.
customValue
$
toAttr
"lbl"
$
TL
.
fromStrict
$
ngramsToLabel
ngrams
[
0
,
1
])
@?=
"钱 | 狗"
testRelComp_Connected
::
Assertion
testRelComp_Connected
=
do
(
relatedComponents
@
Int
)
[]
@?=
[]
(
relatedComponents
@
Int
)
[
[]
]
@?=
[
[]
]
(
relatedComponents
@
Int
)
[
[]
,[
1
,
2
]]
@?=
[
[]
,[
1
,
2
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[]
]
@?=
[[
1
,
2
],
[]
]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
2
]]
@?=
[[
1
,
2
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
2
],[
2
]]
@?=
[[
1
,
2
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
2
],[
2
,
1
]]
@?=
[[
1
,
2
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
2
,
4
]]
@?=
[[
1
,
2
,
4
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
3
,
5
],
[
2
,
4
]]
@?=
[[
3
,
5
],
[
1
,
2
,
4
]]
(
relatedComponents
@
Int
)
[[
1
,
2
],
[
3
,
5
],
[
2
,
4
],[
9
,
5
],[
5
,
4
]]
@?=
[[
1
,
2
,
4
,
3
,
5
,
9
]]
(
relatedComponents
@
Int
)
[[
1
,
2
,
5
],
[
4
,
5
,
9
]]
@?=
[[
1
,
2
,
5
,
4
,
9
]]
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