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
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
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
gargantext
haskell-gargantext
Commits
80ffec62
Commit
80ffec62
authored
Jun 20, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/adinapoli/fix-phylo-types' into dev-merge
parents
8e353331
69fa22f7
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
7900 additions
and
31 deletions
+7900
-31
gargantext.cabal
gargantext.cabal
+3
-1
package.yaml
package.yaml
+3
-0
JSON.hs
src-test/Offline/JSON.hs
+30
-2
Phylo.hs
src/Gargantext/Core/Types/Phylo.hs
+406
-28
bpa_phylo_test.json
test-data/phylo/bpa_phylo_test.json
+6140
-0
open_science.json
test-data/phylo/open_science.json
+1318
-0
No files found.
gargantext.cabal
View file @
80ffec62
...
...
@@ -26,6 +26,8 @@ data-files:
ekg-assets/chart_line_add.png
ekg-assets/cross.png
test-data/ngrams/GarganText_NgramsTerms-QuantumComputing.json
test-data/phylo/bpa_phylo_test.json
test-data/phylo/open_science.json
library
exposed-modules:
...
...
@@ -81,6 +83,7 @@ library
Gargantext.Core.Types.Individu
Gargantext.Core.Types.Main
Gargantext.Core.Types.Query
Gargantext.Core.Types.Phylo
Gargantext.Core.Utils
Gargantext.Core.Utils.Prefix
Gargantext.Core.Viz.Graph
...
...
@@ -235,7 +238,6 @@ library
Gargantext.Core.Text.Terms.Multi.PosTagging
Gargantext.Core.Text.Terms.Multi.PosTagging.Types
Gargantext.Core.Text.Upload
Gargantext.Core.Types.Phylo
Gargantext.Core.Types.Search
Gargantext.Core.Utils.DateUtils
Gargantext.Core.Viz
...
...
package.yaml
View file @
80ffec62
...
...
@@ -45,6 +45,8 @@ data-files:
-
ekg-assets/chart_line_add.png
-
ekg-assets/cross.png
-
test-data/ngrams/GarganText_NgramsTerms-QuantumComputing.json
-
test-data/phylo/bpa_phylo_test.json
-
test-data/phylo/open_science.json
library
:
source-dirs
:
src
ghc-options
:
...
...
@@ -109,6 +111,7 @@ library:
-
Gargantext.Core.Types.Individu
-
Gargantext.Core.Types.Main
-
Gargantext.Core.Types.Query
-
Gargantext.Core.Types.Phylo
-
Gargantext.Core.Utils
-
Gargantext.Core.Utils.Prefix
-
Gargantext.Core.Viz.Graph
...
...
src-test/Offline/JSON.hs
View file @
80ffec62
...
...
@@ -9,16 +9,21 @@ import Data.Aeson
import
Data.Either
import
Gargantext.API.Node.Corpus.New
import
Gargantext.API.Node.Corpus.Types
import
Gargantext.Core.Types.Phylo
import
Gargantext.Core.Viz.Phylo.API
import
Prelude
import
Test.Tasty
import
Test.Tasty.HUnit
import
Test.Tasty.QuickCheck
import
Text.RawString.QQ
import
qualified
Data.ByteString
as
B
import
qualified
Data.ByteString.Lazy.Char8
as
C8
import
Paths_gargantext
jsonRoundtrip
::
(
Show
a
,
FromJSON
a
,
ToJSON
a
,
Eq
a
)
=>
a
->
Property
jsonRoundtrip
a
=
eitherDecode
(
encode
a
)
===
Right
a
jsonRoundtrip
a
=
counterexample
(
"Parsed JSON: "
<>
C8
.
unpack
(
encode
a
))
$
eitherDecode
(
encode
a
)
===
Right
a
tests
::
TestTree
tests
=
testGroup
"JSON"
[
...
...
@@ -26,7 +31,14 @@ tests = testGroup "JSON" [
,
testProperty
"WithQuery roundtrips"
(
jsonRoundtrip
@
WithQuery
)
,
testCase
"WithQuery frontend compliance"
testWithQueryFrontend
,
testGroup
"Phylo"
[
testProperty
"PhyloData"
(
jsonRoundtrip
@
PhyloData
)
testProperty
"PeriodToNode"
(
jsonRoundtrip
@
PeriodToNodeData
)
,
testProperty
"GraphData"
(
jsonRoundtrip
@
GraphData
)
,
testProperty
"GraphDataData"
(
jsonRoundtrip
@
GraphDataData
)
,
testProperty
"ObjectData"
(
jsonRoundtrip
@
ObjectData
)
,
testProperty
"PhyloData"
(
jsonRoundtrip
@
PhyloData
)
,
testProperty
"LayerData"
(
jsonRoundtrip
@
LayerData
)
,
testCase
"can parse bpa_phylo_test.json"
testParseBpaPhylo
,
testCase
"can parse open_science.json"
testOpenSciencePhylo
]
]
...
...
@@ -40,3 +52,19 @@ testWithQueryFrontend = do
-- instances, this test would fail, and we will be notified.
cannedWithQueryPayload
::
String
cannedWithQueryPayload
=
[
r
|
{"query":"Haskell","node_id":138,"lang":"EN","flowListWith":{"type":"MyListsFirst"},"datafield":"External Arxiv","databases":"Arxiv"}
|]
testParseBpaPhylo
::
Assertion
testParseBpaPhylo
=
do
pth
<-
getDataFileName
"test-data/phylo/bpa_phylo_test.json"
jsonBlob
<-
B
.
readFile
pth
case
eitherDecodeStrict'
@
GraphData
jsonBlob
of
Left
err
->
error
err
Right
_
->
pure
()
testOpenSciencePhylo
::
Assertion
testOpenSciencePhylo
=
do
pth
<-
getDataFileName
"test-data/phylo/open_science.json"
jsonBlob
<-
B
.
readFile
pth
case
eitherDecodeStrict'
@
PhyloData
jsonBlob
of
Left
err
->
error
err
Right
_
->
pure
()
src/Gargantext/Core/Types/Phylo.hs
View file @
80ffec62
This diff is collapsed.
Click to expand it.
test-data/phylo/bpa_phylo_test.json
0 → 100644
View file @
80ffec62
This diff is collapsed.
Click to expand it.
test-data/phylo/open_science.json
0 → 100644
View file @
80ffec62
This diff is collapsed.
Click to expand it.
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