def test_sanitize_ico_non_numerics(self): self.assertEqual(None, ContractSanitizer.sanitize_ico(" X")) self.assertEqual(None, ContractSanitizer.sanitize_ico("asdadsas")) self.assertEqual(None, ContractSanitizer.sanitize_ico("ASDASDasdasd")) self.assertEqual(None, ContractSanitizer.sanitize_ico(None)) self.assertEqual("60162694", ContractSanitizer.sanitize_ico("¨60162694")) self.assertEqual("60162694", ContractSanitizer.sanitize_ico("asdasdas60162694asdasdasd")) self.assertEqual("60162694", ContractSanitizer.sanitize_ico("¨.?.60162>?>//694>>>>")) self.assertEqual("60162694", ContractSanitizer.sanitize_ico("6 0 1 6 2 6 9 4 "))
def test_sanitize_ico_combination(self): self.assertEqual("00000012", ContractSanitizer.sanitize_ico(" 12X")) self.assertEqual("02345678", ContractSanitizer.sanitize_ico("asdadsas 2 345 678")) self.assertEqual("00162694", ContractSanitizer.sanitize_ico("¨0 1 6 26 9 4 "))
def test_sanitize_ico_leading_zeros(self): self.assertEqual(None, ContractSanitizer.sanitize_ico(None)) self.assertEqual("00101000", ContractSanitizer.sanitize_ico("101000")) self.assertEqual("00164801", ContractSanitizer.sanitize_ico("164801")) self.assertEqual("00007064", ContractSanitizer.sanitize_ico("7064")) self.assertEqual("00022985", ContractSanitizer.sanitize_ico("22985"))