-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtests.py
executable file
·65 lines (55 loc) · 2.78 KB
/
tests.py
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import unittest
from PIL import Image
from modules.analysis import Analyzer
class TestTestCase(unittest.TestCase):
def test_hello_world(self):
test_str = "hello world"
self.assertEqual(test_str, "hello world")
class AnalyzerTestCase(unittest.TestCase):
def setUp(self):
self.img_name = "she.png"
self.an = Analyzer(display=False)
def test_exif(self):
exif = self.an.exif(self.img_name)
exif.pop('File:FileAccessDate')
self.assertDictEqual({'SourceFile': 'she.png',
'ExifTool:ExifToolVersion': 11.06,
'File:FileName': 'she.png',
'File:Directory': '.',
'File:FileSize': 281404,
'File:FileModifyDate': '2019:04:21 16:58:26+03:00',
'File:FileInodeChangeDate': '2019:04:21 16:58:26+03:00',
'File:FilePermissions': 644,
'File:FileType': 'PNG',
'File:FileTypeExtension': 'PNG',
'File:MIMEType': 'image/png',
'File:ExifByteOrder': 'MM',
'PNG:ImageWidth': 696,
'PNG:ImageHeight': 320,
'PNG:BitDepth': 8,
'PNG:ColorType': 2,
'PNG:Compression': 0,
'PNG:Filter': 0,
'PNG:Interlace': 0,
'EXIF:ImageDescription': 'kx0znibp',
'EXIF:Make': 'Subscribe To PewDiePie',
'EXIF:Model': 'Nokia 3310',
'EXIF:ResolutionUnit': 2,
'EXIF:Software': 'InsertTxt',
'EXIF:Artist': 'Who is she?',
'EXIF:YCbCrPositioning': 1,
'EXIF:ExifVersion': '0231',
'EXIF:DateTimeOriginal': '2018:12:01 16:00:49',
'EXIF:CreateDate': '2018:11:30 14:00:36',
'EXIF:ComponentsConfiguration': '1 2 3 0',
'EXIF:UserComment': 'rel luminance',
'EXIF:FlashpixVersion': '0100',
'Composite:ImageSize': '696x320',
'Composite:Megapixels': 0.22272}, exif)
def start_tests():
analyzerTestSuit = unittest.TestSuite()
analyzerTestSuit.addTest(unittest.makeSuite(AnalyzerTestCase))
runner = unittest.TextTestRunner(verbosity=2)
runner.run(analyzerTestSuit)
if __name__ == '__main__':
unittest.main()