Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    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')])
Beispiel #4
0
    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')])
Beispiel #5
0
    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)
Beispiel #6
0
    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)