Writing Tests First with Comments

Clarify intentions before coding.
class LocalBankTransfers(unittest.TestCase):
	def test_TransferWithInsufficientFunds_should_FailAndApplyNsfCharge(self):
		# Irrelevant

		# Initial state
		# Source and destination accounts exist with money in each

		# Action:
		# Transfer money from source to destination, sending more than the source's balance

		# Outcome:
		# Verify that both the source balance reduced by the insufficient funds charge, the
		# destination balance didn't change, and the correct account message is added
		# to the source to explain why the transfer failed and why the charge was applied.
		pass

When Could This Have Applied to You?

  • When did you think you understood what to write, then find out during coding that your understanding was off?
  • When have you had a clarifying conversation or whiteboarding that saved time?
  • When have you forgotten important details from an initial conversation?

The Change

Please log in

This content is only available to students. Please log in to access it.