def test010_test_output(self, mock_open): '''create_file: testing for use of open function Your create_file function not use the open function ''' lab5.create_file('test_asdf.txt', 'data', 5) self.assertTrue(mock_open.called)
def test010_test_output(self, mock_open): '''create_file: testing for use of open function Your create_file function not use the open function ''' lab5.create_file('test_asdf.txt','data', 5) self.assertTrue(mock_open.called)
def test011_test_output(self, mock_open): '''create_file: testing for use of open function Your create_file function not use the open function with the correct arguments ''' lab5.create_file('test_asdf.txt', 'data', 5) mock_open.assert_has_calls([call('test_asdf.txt', 'w')])
def test011_test_output(self, mock_open): '''create_file: testing for use of open function Your create_file function not use the open function with the correct arguments ''' lab5.create_file('test_asdf.txt','data', 5) mock_open.assert_has_calls([call('test_asdf.txt','w')])
def test015_test_output(self): '''create_file: testing output of function is correct Your create_file does not create the file with the correct content ''' path = '.test_asdfasdfasdf' data = 'data' N = 5 lab5.create_file(path, data, N) self.assertTrue(os.path.exists(path)) with open(path) as rfp: new = rfp.read() self.assertEqual(new, data * N)
def test015_test_output(self): '''create_file: testing output of function is correct Your create_file does not create the file with the correct content ''' path = '.test_asdfasdfasdf' data = 'data' N = 5 lab5.create_file(path,data,N) self.assertTrue(os.path.exists(path)) with open(path) as rfp: new = rfp.read() self.assertEqual(new, data*N)