In this case, we have three force:
1.Tesion is a force where the direction is upward.
2.The weight(mg) is a force where the direction is downward.
3.The acceleration is a force where the direction is downward.
Case1:take downward to be positive
T(negative)-mg(positive)=ma(positive)-(*)
Case2:take upward to be positive
T(positive)-mg(negative)=ma(negative)-(1)
(1)x-1, T(positive)x(-1)-mg(negative)(-1)=ma(negative)(-1)
T(negative)-mg(positive)=ma(positive)-(2)
Sub up these two case,by the equation(2) and equation(*) are equal, we know that the result of them is same.