Question: Python code: Using the Python unittest module!!! How do you write black box tests for verifing if a number is within a certain range? For

Python code: Using the Python unittest module!!!

Python code: Using the Python unittest module!!! How do you write black

How do you write black box tests for verifing if a number is within a certain range?

For example, how would you write a test to verify if the first two digits of a credit card number (entered as a string of numbers) are within the range of 51 - 55?

And how would you verify with a test that the first two digits in a string of numbers is 34 or 37?

And how would you write a test to verify that the last digit of the credit card is the correct check digit?

The last digit of the number is referred to as the check digit and acts as a checksum. Most credit cards calculate this check digit using the Luhn algorithm (see resources below for how this is calculated). In order to limit the scope of this assignment, we are going to limit the number of credit card issuers to 3: Visa, MasterCard, and American Express. Each has its own prefixes and length requirements. - Visa Prefix(es): 4 - Length: 16 - MasterCard Prefix(es): 51 through 55 and 2221 through 2720 Length: 16 - American Express Prefix(es): 34 and 37 - Length: 15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!