9
9
10
10
VALID_AMEX = '370000000000002'
11
11
VALID_MC = '5100000000000003'
12
- VALID_VISA = '4050000000000001'
12
+ VALID_VISA_13 = '4050000000001'
13
+ VALID_VISA_16 = '4050000000000001'
14
+ VALID_VISA_19 = '4050000000000000001'
13
15
VALID_OTHER = '2000000000000000008'
14
16
LUHN_INVALID = '4000000000000000'
15
17
LEN_INVALID = '40000000000000006'
@@ -73,7 +75,9 @@ def test_validate_luhn_check_digit(card_number: str, valid: bool):
73
75
@pytest .mark .parametrize (
74
76
'card_number, brand, valid' ,
75
77
[
76
- (VALID_VISA , PaymentCardBrand .visa , True ),
78
+ (VALID_VISA_13 , PaymentCardBrand .visa , True ),
79
+ (VALID_VISA_16 , PaymentCardBrand .visa , True ),
80
+ (VALID_VISA_19 , PaymentCardBrand .visa , True ),
77
81
(VALID_MC , PaymentCardBrand .mastercard , True ),
78
82
(VALID_AMEX , PaymentCardBrand .amex , True ),
79
83
(VALID_OTHER , PaymentCardBrand .other , True ),
@@ -95,7 +99,7 @@ def test_length_for_brand(card_number: str, brand: PaymentCardBrand, valid: bool
95
99
[
96
100
(VALID_AMEX , PaymentCardBrand .amex ),
97
101
(VALID_MC , PaymentCardBrand .mastercard ),
98
- (VALID_VISA , PaymentCardBrand .visa ),
102
+ (VALID_VISA_16 , PaymentCardBrand .visa ),
99
103
(VALID_OTHER , PaymentCardBrand .other ),
100
104
],
101
105
)
@@ -104,8 +108,8 @@ def test_get_brand(card_number: str, brand: PaymentCardBrand):
104
108
105
109
106
110
def test_valid ():
107
- card = PaymentCard (card_number = VALID_VISA )
108
- assert str (card .card_number ) == VALID_VISA
111
+ card = PaymentCard (card_number = VALID_VISA_16 )
112
+ assert str (card .card_number ) == VALID_VISA_16
109
113
assert card .card_number .masked == '405000******0001'
110
114
111
115
0 commit comments