| Conditions | 7 | 
| Total Lines | 22 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | #!/usr/bin/env python | ||
| 7 | def test_gosubdag(): | ||
| 8 | """Test all ways to make a GoSubDag.""" | ||
| 9 | # Get data to use for test | ||
| 10 | res = get_goea_results() | ||
| 11 | godag = res['obo_dag'] | ||
| 12 | goea_results = res['goea_results'] | ||
| 13 | goids = [r.GO for r in goea_results] | ||
| 14 | num_goids = len(goids) | ||
| 15 | |||
| 16 | # Test Arg: goea_results (list of GOEnrichmentRecord objects) | ||
| 17 | go_sources = [rec.GO for rec in goea_results] | ||
| 18 |     go2obj = {rec.GO:rec.goterm for rec in goea_results} | ||
| 19 | gosubdag = GoSubDag(go_sources, go2obj) | ||
| 20 | assert len(gosubdag.go_sources) == len(goea_results) | ||
| 21 | |||
| 22 | # Test Arg: godag (GODag object) | ||
| 23 | gosubdag = GoSubDag(None, godag) | ||
| 24 | assert len(gosubdag.go_sources) > 40000 | ||
| 25 | |||
| 26 | # Test Arg: goids, godag | ||
| 27 | gosubdag = GoSubDag(goids, godag) | ||
| 28 | assert len(gosubdag.go_sources) == num_goids | ||
| 29 | |||
| 33 |