Пример #1
0
 def test_result_1(self):
     """ Function to test data """
     self.assertEqual(function(self.dict_1, self.dict_2), {
         'a': 300,
         'b': 200,
         'c': 300
     }, "Should be {'a': 300, 'b': 200, 'c': 300}")
Пример #2
0
 def test_function(self):
     with open('input.txt') as f:
         input = f.read().splitlines()
     with open('output.txt') as f:
         output = f.read().splitlines()
     for i, o in zip(input, output):
         self.assertEqual(str(function(i)), o)
Пример #3
0
def test_1():
    assert function(3, 6) is False
Пример #4
0
 def test(self):
     self.assertEqual(function(3), 4)
Пример #5
0
 def test_regression_true(self):  # точно истинный вариант
     s1 = '1234567'
     s2 = '456'
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #6
0
from flask import Flask,render_template,request,redirect,send_file,send_from_directory
import os
from werkzeug.utils import secure_filename
from main import function

app=Flask(__name__)#object of flask
fn=function()
fname=""

@app.route('/',methods=['GET','POST'])  #it is decorator
def encryption():
     app.config['UPLOAD_FOLDER'] = 'data/encrypteddata'
    #FILE UPLOADING METHOD 
     if request.method == 'POST' and request.form["action"]=="up":
         print("yeah")
         print("Button press=",request.form['action'])

# check if the post request has the file part
         if 'file' not in request.files:
            # flash('No file part')
            return redirect(request.url)
         file = request.files['file']
        # if user does not select file, browser alsode
        # submit a empty part without filename
         if file.filename == '':
            # flash('No selected file')
            return redirect(request.url)
         if file :
            filenames = secure_filename(file.filename)
            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filenames))
Пример #7
0
 def test_s2_bigger(self):
     s1 = '123'
     s2 = '12345'
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #8
0
 def test_regression_false(self):  # точно ложный вариант
     s1 = '1234567'
     s2 = '46'
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #9
0
 def test_nul_all(self):  # компромиссный вариант
     s1 = ''
     s2 = ''
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #10
0
 def test_max(self):
     s1 = ''
     for i in range(100000):
         s1 += str(randint(0, 9))
     s2 = '1234567'
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #11
0
 def test_null_s2(self):
     s1 = '123'
     s2 = ''
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #12
0
 def test_null_s1(self):
     s1 = ''
     s2 = "123"
     self.assertEqual(function(s1, s2), s1.find(s2))
Пример #13
0
 def test_random(self):
     for i in range(500):
         s1 = str(randint(0, 1000000))
         s2 = str(randint(0, 1000000))
         self.assertEqual(function(s1, s2), s1.find(s2))
Пример #14
0
def test_2():
    assert function(10, 5) is True
Пример #15
0
 def test_equal(self):
     s1 = '12345'
     self.assertEqual(function(s1, s1), s1.find(s1))
Пример #16
0
import main

main.function()
Пример #17
0
 def test_searching(self):
     with open('data.txt') as f:
         lines = f.readlines()
         self.assertEqual('4', function(lines[0]))
         self.assertEqual('', function(lines[1]))
         self.assertEqual('8,9', function(lines[2]))