File: aug_assertions.py

package info (click to toggle)
augustus 3.4.0%2Bdfsg2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 758,480 kB
  • sloc: cpp: 65,451; perl: 21,436; python: 3,927; ansic: 1,240; makefile: 1,032; sh: 189; javascript: 32
file content (40 lines) | stat: -rw-r--r-- 1,579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3

import os

from tests.examples import aug_comparator as comp

def assertEqualDirectory(testcase, refdir, resdir, html=False, htmloutputfolder=None):
    """
       Assert that the specified files are equal
       :param testcase: the calling unittest.TestCase
       :param refdir: the reference directory
       :param resdir: the directory created by the test
       :param html: if true and the files differ a report is written in html format
       :param htmloutputfolder: path for the html diff files, if None a default
              path is used
       :return:
       """
    diff = comp.compare_folder(refdir,
                              resdir,
                              html=html or htmloutputfolder is not None,
                              outputfolder=htmloutputfolder)
    testcase.assertEqual(diff, '')


def assertEqualFiles(testcase, reffile, resfile, html=False, htmloutputfolder=None):
    """
    Assert that the specified files are equal
    :param testcase: the calling unittest.TestCase
    :param reffile: the reference file
    :param resfile: the file created by the test
    :param html: if true and the files differ a report is written in html format
    :param htmloutputfolder: path for the html diff file, if None a default
           path is used
    :return:
    """
    diff = comp.compare_files(reffile,
                              resfile,
                              html=html or htmloutputfolder is not None,
                              outputfolder=htmloutputfolder)
    testcase.assertEqual(diff, '')