umyuu commited on
Commit
76627b5
·
1 Parent(s): 343361c

add testfile

Browse files
test/__init__.py ADDED
File without changes
test/test_create_grayscale_gradation.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ import unittest
3
+
4
+ import numpy as np
5
+ from PIL import Image
6
+
7
+ class TestGrayscale(unittest.TestCase):
8
+ pass
9
+
10
+
11
+ def main():
12
+ # グラデーションのサイズを定義します
13
+ width = 256
14
+ height = 256
15
+
16
+ # numpyを使用してグレースケールのグラデーションを作成します
17
+ gradient = np.linspace(0, 255, width, dtype=np.uint8)
18
+
19
+ # 2次元のグラデーションを作成します
20
+ gradient = np.tile(gradient, (height, 1))
21
+
22
+ # PIL Imageオブジェクトを作成します
23
+ image = Image.fromarray(gradient, mode='L')
24
+
25
+ # 画像を表示します
26
+ image.show()
27
+
28
+ if __name__ == "__main__":
29
+ #main()
30
+ unittest.main()
test/test_files/grayscale_256x256.png ADDED
test/test_files/grayscale_256x256.webp ADDED
test/testrun.bat ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ @echo on
2
+
3
+ cd %~dp0
4
+ call ..\venv\Scripts\activate
5
+ python -m unittest -v test_create_grayscale_gradation.py
6
+
7
+ TIMEOUT /T 30