示例#1
0
 def test_example(self):
     self.assertTrue('./example.data' in test_data.list_files())
     data = test_data.read('example.data')
     self.assertEquals(sorted(['section1', 'section2', 'binary']), sorted(data.keys()))
     self.assertEquals(' abc def\nghi', data['section1'])
     self.assertEquals('123\n456\n789', data['section2'])
     self.assertEquals('\x00\x01\x02\x03\x04\x05\x06\x07\x77\x66\x55\x44\x33\x22\x11\x00',
                       data['binary'])
示例#2
0
def add_datafiles_tests(klass, regex, ofp, pyversion=3):
    for filename in test_data.list_files():
        match = re.match(regex, filename)
        if not match:
            continue
        def make_test(filename):
            def fn(self):
                test_datafile(filename, ofp, pyversion)
            return fn
        setattr(klass, 'test_' + os.path.splitext(filename)[0], make_test(filename))
示例#3
0
def add_datafiles_tests(klass, regex, ofp):
    for filename in test_data.list_files():
        match = re.match(regex, filename)
        if not match:
            continue
        def make_test(filename):
            def fn(self):
                test_datafile(filename, ofp)
            return fn
        setattr(klass, 'test_' + os.path.splitext(filename)[0], make_test(filename))
示例#4
0
 def test_all(self):
     for name in test_data.list_files():
         test_data.read(name)
示例#5
0
 def test_all(self):
     for name in test_data.list_files():
         test_data.read(name)
示例#6
0
def test_datafiles():
    # Nose test generator
    # Creates a testcase for each datafile
    for filename in test_data.list_files():
        yield check_datafile, filename
示例#7
0
def test_datafiles():
    for filename in test_data.list_files():
        yield check_datafile, filename
示例#8
0
def test_datafiles():
    # Nose test generator
    # Creates a testcase for each datafile
    for filename in test_data.list_files():
        yield check_datafile, filename