Any chance someone can give me some guidance on what to do here? I just need some advice on where I should start and how. Test this regular expression : ^(?!666|000)(?P<area>[0-8][0-9]{2})[- ]?(?!00)(?P<group>\d{2})[- ]?(?!0000)(?P<serial>\d{4})$ You should test all these cases: - all valid SSNs constructed with - connectors: 001-01-0001, 001-01-0002, ... 899-99-9999 - all invalid SSNs beginning with 666- - all invalid SSN's in the range of 900- to 999- - representative invalid samples equaling 0 in each SSN section: 000-xx-xxxx, xxx-00-xxxx and xxx-xx-0000 You should count and report the number of positive assertions performed. This number should be greater than 98M. Submit your python source file containing the tests. Submit the console output generated when your tests are run (Screen shot or text in a file) You can start with: import reclass SSN:debug = Falsepattern = r"^(?!666|000)(?P<area>[0-8][0-9]{2})[- ]?(?!00)(?P<group>\d{2})[- ]?(?!0000)(?P<serial>\d{4})$"ssn_regex = re.compile(pattern)@staticmethoddef is_valid(number):match = SSN.ssn_regex.match(number)if match == None:return Falsereturn match.group() == number Also, you may want to refer to an example we did in class: import unittestfrom dice_notation import DiceNotationclass TestDiceNotation(unittest.TestCase):    def test_is_valid_3d6(self):        self.assertTrue(DiceNotation.is_valid('3d6'))            def test_is_valid_3d16(self):        self.assertTrue(DiceNotation.is_valid('3d16'))            def test_is_valid_potato(self):        self.assertFalse(DiceNotation.is_valid('potato'))            def test_is_valid_1d6_plus_plus_5(self):        self.assertFalse(DiceNotation.is_valid('1d6++5'))            def test_dice_notation_1d12_div_2_minus_1_roll100(self):        notation = DiceNotation('1d12/2-1')        for _ in range(100):            roll = notation.roll()            self.assertTrue(roll >= -1 and roll <= 5)              if __name__ == '__main__':    unittest.main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Any chance someone can give me some guidance on what to do here? I just need some advice on where I should start and how.

Test this regular expression :

^(?!666|000)(?P<area>[0-8][0-9]{2})[- ]?(?!00)(?P<group>\d{2})[- ]?(?!0000)(?P<serial>\d{4})$
You should test all these cases:
- all valid SSNs constructed with - connectors: 001-01-0001, 001-01-0002, ... 899-99-9999
- all invalid SSNs beginning with 666-
- all invalid SSN's in the range of 900- to 999-
- representative invalid samples equaling 0 in each SSN section: 000-xx-xxxx, xxx-00-xxxx and xxx-xx-0000
You should count and report the number of positive assertions performed. This number should be greater than 98M.
Submit your python source file containing the tests.
Submit the console output generated when your tests are run (Screen shot or text in a file)
You can start with:
import re

class SSN:

debug = False

pattern = r"^(?!666|000)(?P<area>[0-8][0-9]{2})[- ]?(?!00)(?P<group>\d{2})[- ]?(?!0000)(?P<serial>\d{4})$"

ssn_regex = re.compile(pattern)

@staticmethod

def is_valid(number):

match = SSN.ssn_regex.match(number)

if match == None:

return False

return match.group() == number

Also, you may want to refer to an example we did in class:

import unittest
from dice_notation import DiceNotation

class TestDiceNotation(unittest.TestCase):

    def test_is_valid_3d6(self):
        self.assertTrue(DiceNotation.is_valid('3d6'))
        
    def test_is_valid_3d16(self):
        self.assertTrue(DiceNotation.is_valid('3d16'))
        
    def test_is_valid_potato(self):
        self.assertFalse(DiceNotation.is_valid('potato'))
        
    def test_is_valid_1d6_plus_plus_5(self):
        self.assertFalse(DiceNotation.is_valid('1d6++5'))
        
    def test_dice_notation_1d12_div_2_minus_1_roll100(self):
        notation = DiceNotation('1d12/2-1')
        for _ in range(100):
            roll = notation.roll()
            self.assertTrue(roll >= -1 and roll <= 5)
        
      
if __name__ == '__main__':
    unittest.main()

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education