Esempio n. 1
0
    def test_5():
        ori_path = ''.join([pre, 'orig5.txt'])

        print(' '.join(['testing', os.path.basename(smp_path), 'and', os.path.basename(ori_path)]) + ':')
        sim = duplicate_check([ori_path, smp_path])

        with open(sum_path, 'a', encoding='utf-8') as s:
            s.write('test5: {:.2f}\n'.format(sim))
Esempio n. 2
0
    def test_blank2(self):
        smp_path = ''.join([pre, 'blank.txt'])

        print(' '.join([
            'testing',
            os.path.basename(smp_path), 'and',
            os.path.basename(ori_path)
        ]) + ':')
        sim = duplicate_check([smp_path, smp_path])

        self.assertEqual(sim, 1.0, msg='Error! They are blank documents!')
Esempio n. 3
0
    def test_blank(self):
        smp_path = ''.join([pre, 'blank.txt'])

        print(' '.join([
            'testing',
            os.path.basename(smp_path), 'and',
            os.path.basename(ori_path)
        ]) + ':')
        sim = duplicate_check([ori_path, smp_path])

        self.assertEqual(sim, 0.0, msg='Error! One of the documents is blank!')
Esempio n. 4
0
    def test_same(self):
        smp_path = ori_path

        print(' '.join([
            'testing',
            os.path.basename(smp_path), 'and',
            os.path.basename(ori_path)
        ]) + ':')
        sim = duplicate_check([ori_path, smp_path])

        self.assertEqual(sim, 1.0, msg='Error! They are the same documents!')
Esempio n. 5
0
    def test_noise(self):
        smp_path = ''.join([pre, 'noise.txt'])

        print(' '.join([
            'testing',
            os.path.basename(smp_path), 'and',
            os.path.basename(ori_path)
        ]) + ':')
        sim = duplicate_check([ori_path, smp_path])

        self.assertLess(sim, 0.05, msg='Error! They have nothing in common!')
Esempio n. 6
0
    def test_input_path2():
        smp_path = '.'

        print('testing if file exists:')
        duplicate_check([ori_path, smp_path])
Esempio n. 7
0
    def test_input_path1():
        smp_path = './path/error.txt'

        print('testing if path exists:')
        duplicate_check([smp_path, ori_path])