Пример #1
0
def validate_all(raw_data):
    """
    >>> validate_all(["T123", "M", "28", "100", "heisobesity", "$350", "11-09-1990"])
    ['T123', 'M', '28', 100, 'Obesity', 350, '11-09-1990']
    """
    v = DataValidator()
    return v.check_all(raw_data)
Пример #2
0
def validate_bmi(bmi):
    """
    >>> validate_bmi("not a valid bmi")

    """
    v = DataValidator()
    return v.validators[Data.BMI.value](bmi)
Пример #3
0
def validate_salary(salary):
    """
    >>> validate_salary("three hundred")

    """
    v = DataValidator()
    return v.validators[Data.SALARY.value](salary)
 def __init__(self):
     Cmd.__init__(self)  # Initialize cmd interface here
     self.prompt = ">>> "  # Initialize prompt
     self._vld = DataValidator(
     )  # Object of DataValidator, for validating data
     self._std = EmployeeData()  # Instance of EmployeeData
     self.intro = "WELCOME TO THE EMPLOYEE DATABASE MANAGEMENT CONSOLE \n ENTER A KEYWORD TO START. FOT HELP, ENTER \"help\"."
Пример #5
0
 def __init__(self):
     Cmd.__init__(self)  # Initialize cmd interface here
     self.prompt = ">>> "  # Initialize prompt
     self._vld = DataValidator(
     )  # Object of DataValidator, for validating data
     #       self._graph = GraphDirector()
     #        self._grp = Graph()
     self._graph = ShowGraph()
     self._shw = GetEmployee()  # Instace of GetEmployeeData
     self.intro = "WELCOME TO THE EMPLOYEE DATABASE MANAGEMENT CONSOLE \n ENTER A KEYWORD TO START. FOT HELP, ENTER \"help\"."
Пример #6
0
    def __init__(self):
        Cmd.__init__(self)

        # The command line indicator
        self.prompt = ">>> "

        # Welcome information
        self.intro = "Welcome to Staff Information System\nEnter a keyword to start. For help, enter \"help\"."

        # Object of DataValidator, for validating data
        self._vld = DataValidator()

        # Instance of StaffData
        self._std = StaffData()
Пример #7
0
def get_bmi():
    """
    >>> get_bmi()
    {'Obesity': 1, 'Normal': 2}
    """
    sd = EmployeeData()
    v = DataValidator()
    sd.add_data(
        v.check_all(["T133", "M", "28", "100", "Obesity", "350",
                     "11-09-1990"]))
    sd.add_data(
        v.check_all(["T134", "M", "29", "150", "Normal", "300", "12-08-1989"]))
    sd.add_data(
        v.check_all(["T135", "F", "30", "100", "Normal", "300", "13-07-1988"]))
    return sd.get_bmi()
def get_gender():
    """
    >>> get_gender()
    {'Male': 2, 'Female': 1}
    """
    sd = StaffData()
    v = DataValidator()
    sd.add_data(
        v.check_all(["T133", "M", "28", "100", "Obesity", "350",
                     "11-09-1990"]))
    sd.add_data(
        v.check_all(["T134", "M", "29", "150", "Normal", "300", "12-08-1989"]))
    sd.add_data(
        v.check_all(["T135", "F", "30", "100", "Normal", "300", "13-07-1988"]))
    return sd.get_gender()
 def test_10(self):
     vld = DataValidator()
     self.assertTrue(len(vld.validators) == 7)
Пример #10
0
 def setUp(self):
     self.vld = DataValidator()