TestNetflix - def test_subavg(self):...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python import unittest, os, glob import Netflix from Netflix import netflix_read, netflix_eval, netflix_write, build_probe_dict, build_user_decade_dict, build_moviedict, subAvg, compute_decade_avg class TestNetflix (unittest.TestCase) : def test_read(self): """ Test case for read """ testData = netflix_read("TestNetflix.in") assert testData[0] == "Testing\n" assert testData[1] == "1\n" assert testData[2] =="2\n" assert testData[3] == "3\n" assert testData[4] == "Testing\n"
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: def test_subavg(self): """ Test case for subavg """ x = 1880 y = 1890 testList = [[5, 1881],[4,1882],[3,1883],[2,1884],[1,1885]] avg = subAvg(x,y,testList) assert avg == 3 def test_write(self): """ Test case for write """ testList = ["1\n", "2\n", "3\n", "4\n", "5\n"] netflix_write(testList) testList2 = netflix_read("RunNetlix.out") assert testList2[0] == "1\n" if __name__ == "__main__" : print "TestNetflix.py" unittest.main() print "Done."...
View Full Document

Ask a homework question - tutors are online