runtime
241 / 500
question 241 Testing & Code Quality · easy

Tests for a SKU checker

Runtime Market SKUs look like SPO-11681: three capital letters, a dash, then exactly five digits. valid_sku(text) is already written and correct. Write a TestCase, TestValidSku, whose tests would catch a broken version of it. Check runs your tests against the correct function and against several broken ones.

Writeclass TestValidSku(unittest.TestCase) with test methods using assertTrue / assertFalse
Rulevalid_sku("SPO-11681") → True; anything else → False, e.g. "spo-11681", "SPO-1168", "SPO11681"

Loading your progress…

Tests for a SKU checker — Python practice · Runtime