File: test_invalid.py

package info (click to toggle)
python-biplist 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 232 kB
  • ctags: 224
  • sloc: python: 1,100; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 980 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
from biplist import *
import os
from test_utils import *
import unittest

class TestInvalidPlistFile(unittest.TestCase):
    def setUp(self):
        pass
    def testEmptyFile(self):
        try:
            readPlist(data_path('empty_file.plist'))
            self.fail("Should not successfully read empty plist.")
        except NotBinaryPlistException as e:
            pass
        except InvalidPlistException as e:
            pass
    
    def testTooShort(self):
        try:
            readPlistFromString(b"bplist0")
            self.fail("Should not successfully read plist which is too short.")
        except InvalidPlistException as e:
            pass
    
    def testInvalid(self):
        try:
            readPlistFromString(b"bplist0-------------------------------------")
            self.fail("Should not successfully read invalid plist.")
        except InvalidPlistException as e:
            pass
        
if __name__ == '__main__':
    unittest.main()