Skip to content
Permalink
Browse files

added test for _main function

  • Loading branch information...
athalhammer committed Jul 18, 2019
1 parent 05c789b commit c4c3bfb3ee74634eba4ec59508534a854769b7e5
Showing with 29 additions and 1 deletion.
  1. +21 −1 README.md
  2. +8 −0 test/danker_test.py
@@ -42,7 +42,26 @@ __danker__ is a compilation of Bash and Python3 scripts that enables the computa
$ for i in $(./script/get_languages.sh); do ./danker.sh "$i"; done
$ for i in $(./script/get_languages.sh); do ./danker.sh "$i" "BIGMEM"; done
```
* As a library for computing PageRank on large graphs:
* Standalone with any input graph:
```
usage: danker.py [-h]
left_sorted [right_sorted] damping iterations start_value
danker PageRank. Compute PageRank on large graphs on low-cost hardware.
positional arguments:
left_sorted A two-column, tab-separated file sorted by the left column.
right_sorted The same file as left_sorted but sorted by the right column.
damping PageRank damping factor.
iterations Number of PageRank iterations.
start_value PageRank starting value.
optional arguments:
-h, --help show this help message and exit
```

* As Python library for computing PageRank on large graphs:
```
$ pip install git+https://github.com/athalhammer/danker.git
$ python3
@@ -94,6 +113,7 @@ Execute the unit tests as follows:

```
python3 -m unittest test/danker_test.py
```


@@ -5,6 +5,7 @@
"""
import unittest
import os
import sys
import networkx as nx
import numpy as np
import danker
@@ -31,6 +32,13 @@ def _compare(self, netx, dank):
print(np.corrcoef(res[0], res[1]))
self.assertAlmostEqual(np.corrcoef(res[0], res[1])[0][1], 1, places=6)

def test_main(self):
"""
Test main method
"""
sys.argv=[sys.argv[0], './test/graphs/test.links', '0.85', '10', '1']
danker.danker._main()

def test_left_sort(self):
"""
Test if assert for left sort works (test with right sorted file)

0 comments on commit c4c3bfb

Please sign in to comment.
You can’t perform that action at this time.