1. 程式人生 > >ddt檔案驅動使用中的坑

ddt檔案驅動使用中的坑

程式碼中加了一個註釋

	···
	    @ddt.data(
	        ['郵箱格式不正確','111'],
	        ['郵箱格式不正確','[email protected]'],
	        ['郵箱格式不正確','[email protected]@'],
	        ['郵箱格式不正確','[email protected]']
	        )
	    @ddt.unpack
	···

	    @ddt.data(*data)
	    def test_register(self,data):
	        error_info,
email = data email_error = self.login.email_error(error_info,email) self.assertTrue(email_error)

報錯資訊:

@ddt.data(*data) ^
IndentationError: unexpected indent

解決方法:

刪除註釋