Пример #1
0
    def test_email_error(self):
        msg = "Send $5 to John Snow {0}{1}"
        no_rparen = Check(
            msg.format('([email protected]', ' for The Night Watch'))
        no_lparen = Check(
            msg.format('[email protected])', ' for The Night Watch'))
        valid_no_for1 = Check(msg.format('([email protected])', None))
        valid_no_for2 = Check(msg.format('([email protected]).', None))
        valid_for = Check(
            msg.format('([email protected])', ' for The Night Watch'))

        self.assertTrue(no_rparen.errors)
        self.assertEqual(no_rparen.errors, ["Invalid email", self.format_msg])

        self.assertTrue(no_lparen.errors)
        self.assertEqual(no_lparen.errors,
                         ["Invalid name", "Invalid email", self.format_msg])

        self.assertFalse(valid_no_for1.errors)
        self.assertEqual(valid_no_for1.email, '*****@*****.**')

        self.assertFalse(valid_no_for2.errors)
        self.assertEqual(valid_no_for2.email, '*****@*****.**')

        self.assertFalse(valid_for.errors)
        self.assertEqual(valid_for.email, '*****@*****.**')
Пример #2
0
    def test_general_error(self):
        msg = "send $5 to John Snow ([email protected]) for The Night Watch"
        expected = ['Start message with "Send"', self.format_msg]
        c = Check(msg)

        self.assertTrue(c.errors)
        self.assertEqual(c.errors, expected)
Пример #3
0
    def test_name_error(self):
        msg = "Send $5 toJohn Snow ([email protected]) for The Night Watch"
        expected = ["Invalid name", self.format_msg]
        c = Check(msg)

        self.assertTrue(c.errors)
        self.assertEqual(c.errors, expected)
Пример #4
0
 def __init__(self, array1, array2, populacao, fitness, estadoInicial):
     self.array1 = array1
     self.array2 = array2
     self.populacao = populacao
     self.fitness = fitness
     self.estadoInicial = estadoInicial
     self.check = Check()
Пример #5
0
    def test_amount_error_general(self):
        msg = "Send 5 to John Snow ([email protected]) for The Night Watch"
        expected = ['Invalid amount.', self.format_msg]
        c = Check(msg)

        self.assertTrue(c.errors)
        self.assertEqual(c.errors, expected)
Пример #6
0
    def test_amount_error_not_number(self):
        msg = "Send $five to John Snow ([email protected]) for The Night Watch"
        expected = ['Amount is not a number.', self.format_msg]
        c = Check(msg)

        self.assertTrue(c.errors)
        self.assertEqual(c.errors, expected)
Пример #7
0
def incoming_sms():
    """Send a dynamic reply to an incoming text message"""
    # Get the message the user sent our Twilio number
    body = request.values.get('Body', None)

    # Start our TwiML response
    resp = MessagingResponse()

    # Determine the right reply for this message
    if body:
        sms_check = Check(body)
        if not sms_check.errors:
            response = send_check(sms_check)
            if response.status_code == 201:
                resp.message("The check was sent.")
            else:
                print("Checkbook.io API response info:")
                print(body)
                print(response.text)
                print(sms_check.checkbook_post_data())
                print(response.status_code)
                resp.message("API call was not successful.")
        else:
            print("Message parsing errors:")
            print(sms_check.errors)
            resp.message("Check is not valid." + str(sms_check.errors))

    return str(resp)
Пример #8
0
 def __init__(self, vuls, proxy=False):
     self.vuls = vuls
     self.size = 6
     self.proxy = proxy
     self.check = False
     self.check = Check()
     self.load()
     self.lock = Lock()
     self.pool = ThreadPool(self.size)
Пример #9
0
 def test_valid_check(self):
     msg = "Send $5 to John Snow ([email protected]) for The Night Watch"
     expected = {
         "name": 'John Snow',
         "recipient": '*****@*****.**',
         "amount": 5.0,
         "description": "The Night Watch"
     }
     c = Check(msg)
     self.assertEqual(c.checkbook_post_data(), expected)
Пример #10
0
    def test_invalid_check(self):
        msg = "send 5 to John Snow [email protected]) for armor."
        expected = [
            'Start message with "Send"', 'Invalid amount.', 'Invalid name',
            'Invalid email', self.format_msg
        ]
        c = Check(msg)

        self.assertTrue(c.errors)
        self.assertEqual(c.errors, expected)
Пример #11
0
    def test_amount_error_is_number(self):
        msg = "Send {0} to John Snow ([email protected]) for The Night Watch"
        expected = [
            'Amount can only have two decimal places.', self.format_msg
        ]

        no_dec = Check(msg.format('$500'))
        extra_zeros = Check(msg.format('$5.20000'))
        frac = Check(msg.format('$5.123'))

        self.assertFalse(no_dec.errors)
        self.assertEqual(no_dec.amount, 500)

        self.assertFalse(extra_zeros.errors)
        self.assertEqual(extra_zeros.amount, 5.20)

        self.assertTrue(frac.errors)
        self.assertEqual(frac.errors, expected)
        self.assertEqual(frac.amount, None)
Пример #12
0
    def heuristic(self):
        number_squares = 0
        checker = Check(self.initState.board)

        for i in range(self.initState.size):
            if sum(self.initState.board[i]) == 0:
                for j in range(self.initState.size):
                    if checker.checkALL(i, j):
                        number_squares += 1

        return number_squares
Пример #13
0
    def expand(self):
        nextStates = []

        checker = Check(self.initState.board)

        for i in range(self.initState.size):
            for j in range(self.initState.size):
                if checker.checkALL(i, j):
                    nextState = copy.deepcopy(self)
                    nextState.setVal(i, j, 1)
                    nextStates.append(nextState)
        return nextStates
Пример #14
0
	def __init__(self , path):
		self.estadoInicial = [1,2,3,4,5,6,7,8]
		self.tamanhoPopulacao = 40
		self.variacao = [4,14]  
		self.morte = 0.40 
		self.morteLimite = self.morte * self.tamanhoPopulacao
		self.path = path
		self.arquivo = Arquivo()
		self.linha = []
		self.coluna = []

		self.populacao=[]
		self.fitness=[]
		self.melhorResultado = False
		self.check = Check()

		self.executavel()
Пример #15
0
def Game(Master, Player_lst, Turn, Rule_set):
    from Check import Check
    from Move import Move
    from Play import Play
    while True:
        m = Move(Master, Player_lst, Turn)  #Client
        if Play(m, Master, Player_lst,
                Turn) == True:  #Checks wether move is valid
            break
    while True:
        Rules = Check(Master, Rule_set)
        if Rules != -1:
            if '+' in Rules:  #can send back to Move()
                Applier('+')
            elif '0' in Rules:
                Applier('0')
            elif '*' in Rules:
                Applier('*')
            elif '1' in Rules:  #Can't Play draws a card
                Applier('1')
        elif Rules == -1:
            return
Пример #16
0
    # Get values from second project.
    event_2 = "acute_arm_1"
    instance_2 = None

    othtreti, othtreti_hidden = getEntryLR(record_id, event_2, instance_2, "othtreti", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1])
    ster, ster_hidden = getEntryLR(record_id, event_2, instance_2, "ster", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1])
    acyclo, acyclo_hidden = getEntryLR(record_id, event_2, instance_2, "acyclo", records_list[1], record_id_map_list[1], metadata_list[1], form_repetition_map_list[1])    

    if (vstetiol == '1'):
        if (othtreti == '') or ((ster == '') and (not ster_hidden)) or ((acyclo == '') and (not acyclo_hidden)):
            element_bad = True

    return element_bad

#print "************************SKIPPING CHECK '"+name+"' FOR TEST************************"
checklist.append(Check(name, description, report_forms, inter_project, whole_row_check, check_invalid_entries, inter_record, inter_row, specify_fields, target_fields, rowConditions, fieldConditions, checkFunction))
del name, description, inter_project, whole_row_check, check_invalid_entries, inter_record, inter_row, specify_fields, target_fields, rowConditions, fieldConditions, checkFunction


#### Check: In VIPS II, Interview, if family history of stroke <45 is yes (fhstrkyng=1), then in IPSS, Other Child and Neonatal Risk Factors, stroke < 50 years of age should also be yes (hstroke=1).
name = "fam_hist_stroke_consistent"
description = 'In VIPS II, Interview, if family history of stroke <45 is yes (fhstrkyng=1), then in IPSS, Other Child and Neonatal Risk Factors, stroke < 50 years of age should also be yes (hstroke=1).'
report_forms = True
inter_project = True
whole_row_check = False
check_invalid_entries = False
inter_record = False
inter_row = True
specify_fields = True
target_fields = ['fhstrkyng'] # list target fields in the first project only; only links to these fields will be generated.
Пример #17
0
	def __init__(self, data):
		all_d = data.split('\t', 1)
		self.id = all_d[0]
		self.first_treat = False
		self.treament_line = False
		self.Check_list = [Check(all_d[1])]
Пример #18
0
 def get_all_checks(self):
     checks = []
     for check_id in self.__get_all_checks_ids():
         checks.append(Check(check_id))
     return checks
Пример #19
0
    'host': '192.168.6.133',
    'httpport': '80',
    'sshport': '22',
    'sshuser': '******',
    'sshpass': '******',
    'htmlDict': {
        '/index.php': [
            'MD5',
            '2decodebeauty',
        ],
        '/index.php?page=phpcom': ['phpcom', 'decodebeauty', 'basiccompress']
    },
    'CmdDict': {
        'ls -l  /var/www/html/logs': [
            u'total 4\n',
            u'-rwxr-xr-x 1 www-data www-data 40 Aug 28 15:28 logfile.php\n'
        ],
        'ls /var/www/html/': [
            u'action.php\n', u'config.php\n', u'error.php\n', u'favicon.ico\n',
            u'index.php\n', u'library\n', u'logs\n', u'md5.php\n',
            u'normaliz.php\n', u'phpcom.php\n', u'static\n', u'uploadfile\n',
            u'views\n'
        ]
    },
}

CC = Check(obj['awdname'], obj['host'])
CC.CheckHttp(obj['httpport'], obj['htmlDict'])
CC.Login(obj['sshport'], obj['sshuser'], obj['sshpass'])
CC.CheckCmd(obj['CmdDict'])
print CC.exe("sss")
Пример #20
0
from Check import Check
from Patient import Patient

f = open('data.txt', 'r+')
title = f.readline()
his = f.read()
target = "铂"

p_list = {}
for line in his.split('\n'):
	id = line.split('\t', 1)[0]
	if id not in p_list.keys():
		P = Patient(line)
		p_list[id] = P
	else:
		C = Check(line.split('\t', 1)[1])
		p_list[id].Check_list.append(C)

for key,value in p_list.items():
	#print value.id
	for record in value.Check_list:
		#print record.Treat
		if value.first_treat == False:
			if record.Treat != "None":
				#first treatment
				value.first_treat = True
				if '+' in record.Treat:
					t_ct = 0
					medinces = record.Treat.split('+')
					for m in medinces:
						if target in m:
Пример #21
0
from Roots import Roots
from Roots import Discriminant
from Check import Check

a = input("введите a")
b = input("введите b")
c = input("введите c")

my_check = Check(a, b, c)

if my_check.check_values():
    my_dis = Discriminant(a, b, c)
    print(my_dis.get_discriminant())
    my_roots = Roots(a, b, my_dis.get_discriminant())
    print(my_roots.get_roots())
else:
    print("Введите числа")
Пример #22
0
    def rsizerCreate(self):
        '''
        ###################################
        # rSizer Description Text
        #
        ## globals itemInfo, itemNumber
        ####################################
        '''
        self.logger.log_info(self.rsizerCreate.__name__,
                             "THIS IS A MESSAGE in rsizerCreate")
        self.descriptionTextField = wx.TextCtrl(self.mainPanel,
                                                size=(300, 500),
                                                style=wx.TE_MULTILINE
                                                | wx.TE_RICH2)

        results = Check(self)
        description = results.description()
        self.descriptionTextField.AppendText(description)

        self.descriptionTextField.Bind(
            wx.EVT_TEXT, self.eventsHandler.onDescriptionTextField)

        self.rSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.rSizer.Add(self.descriptionTextField, 0, wx.ALL, 5)
        self.currentTitleLbl = wx.StaticText(self.mainPanel, label='Title')
        self.currentTitleText = wx.TextCtrl(self.mainPanel,
                                            size=(300, 60),
                                            style=wx.TE_MULTILINE)
        self.currentTitleText.Bind(wx.EVT_TEXT,
                                   self.eventsHandler.onCurrentTitleText)

        # self.currentBoxLbl = wx.StaticText(self.mainPanel, label='Current Box')
        # self.currentBoxText = wx.TextCtrl(self.mainPanel, size=(40,-1))
        self.currentConditionLbl = wx.StaticText(self.mainPanel,
                                                 label='Condition 1-5')
        self.currentConditionText = wx.TextCtrl(self.mainPanel, size=(40, -1))
        self.currentConditionText.Bind(
            wx.EVT_TEXT, self.eventsHandler.onCurrentConditionText)
        # Issue #19
        self.currentAuctionIncludesLbl = wx.StaticText(
            self.mainPanel, label='Auction Includes')
        self.currentAuctionIncludesText = wx.TextCtrl(self.mainPanel,
                                                      size=(120, 40),
                                                      style=wx.TE_MULTILINE)
        self.currentAuctionIncludesText.Bind(
            wx.EVT_TEXT, self.eventsHandler.onCurrentAuctionIncludesText)
        self.currentConditionNotesLbl = wx.StaticText(self.mainPanel,
                                                      label='Condition Notes')
        self.currentConditionNotesText = wx.TextCtrl(self.mainPanel,
                                                     size=(120, 40),
                                                     style=wx.TE_MULTILINE)
        self.currentConditionNotesText.Bind(
            wx.EVT_TEXT, self.eventsHandler.onCurrentConditionNotesText)
        self.currentDateListedLbl = wx.StaticText(self.mainPanel,
                                                  label='Date Listed')
        self.currentDateListedText = wx.TextCtrl(self.mainPanel, size=(60, -1))
        self.currentDateListedText.Bind(wx.EVT_TEXT,
                                        self.eventsHandler.onDateListedText)
        # Create Lbls/Text
        self.saveDescriptionTextBtn = wx.Button(self.mainPanel,
                                                label='Save Current')
        self.saveDescriptionTextBtn.Bind(
            wx.EVT_BUTTON, self.eventsHandler.onSaveCurrentTextBtn)

        # Create rSizerCurrentItemSizer add lbl/text
        self.rSizerCurrentItemSizer = wx.BoxSizer(wx.VERTICAL)
        self.rSizerCurrentItemSizer.Add(self.currentTitleLbl, 0, wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentTitleText, 0, wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentAuctionIncludesLbl, 0,
                                        wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentAuctionIncludesText, 0,
                                        wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentConditionLbl, 0, wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentConditionText, 0, wx.ALL,
                                        5)
        self.rSizerCurrentItemSizer.Add(self.currentConditionNotesLbl, 0,
                                        wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentConditionNotesText, 0,
                                        wx.ALL, 5)
        self.rSizerCurrentItemSizer.Add(self.currentDateListedLbl, 0, wx.ALL,
                                        5)
        self.rSizerCurrentItemSizer.Add(self.currentDateListedText, 0, wx.ALL,
                                        5)
        self.rSizerCurrentItemSizer.Add(self.saveDescriptionTextBtn, 0, wx.ALL,
                                        5)
        self.rSizer.Add(self.rSizerCurrentItemSizer)
        self.rSizer.Hide(self.rSizerCurrentItemSizer, recursive=True)

        return
Пример #23
0
 def Check(self):
     EdkLogger.quiet("Checking ...")
     EccCheck = Check()
     EccCheck.Check()
     EdkLogger.quiet("Checking  done!")