def validate_phone(self, value): if not validate_mobile_number(value) and value: raise serializers.ValidationError("Not a valid mobile number") return value
import unittest