Skip to content

Commit

Permalink
added test for _main function
Browse files Browse the repository at this point in the history
  • Loading branch information
athalhammer committed Jul 18, 2019
1 parent 05c789b commit c4c3bfb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -94,6 +113,7 @@ Execute the unit tests as follows:

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

```
Expand Down
8 changes: 8 additions & 0 deletions test/danker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""
import unittest
import os
import sys
import networkx as nx
import numpy as np
import danker
Expand All @@ -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)
Expand Down

0 comments on commit c4c3bfb

Please sign in to comment.