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))
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!')
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!')
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!')
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!')
def test_input_path2(): smp_path = '.' print('testing if file exists:') duplicate_check([ori_path, smp_path])
def test_input_path1(): smp_path = './path/error.txt' print('testing if path exists:') duplicate_check([smp_path, ori_path])