def test_get_set_total_valid(self): f = open("counts.txt", "r") total1 = 10 + int(f.readline()) total2 = 10 + int(f.readline()) f.close() happysad.get_set_total(10, 10) f = open("counts.txt", "r") self.assertEquals(total1, int(f.readline())) self.assertEquals(total2, int(f.readline())) f.close()
def test_get_set_total_empty_file(self): """ Tests the get and set total on an empty file """ f = open("counts.txt", "r+") f.truncate() happysad.get_set_total(0, 0) self.assertEquals(0, int(f.readline())) self.assertEquals(0, int(f.readline())) f.close()