Skip to content

Commit 1b990b7

Browse files
committed
feat: Add rmqrcode_test.py
1 parent ceb43d1 commit 1b990b7

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

setup.cfg

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = rmqrcode
3-
version = 0.0.6
3+
version = 0.0.7
44
author = Takahiro Tomita
55
author_email = [email protected]
66
description = An rMQR Code Generetor
@@ -16,9 +16,13 @@ classifiers =
1616
package_dir =
1717
= src
1818
packages = find:
19-
python_requires = >=3.6
19+
python_requires = >=3.7
2020
install_requires =
2121
Pillow
2222

23+
[options.extras_require]
24+
dev =
25+
pytest
26+
2327
[options.packages.find]
2428
where = src

src/rmqrcode/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from .rmqrcode import rMQR
22
from .rmqrcode import FitStrategy
33
from .rmqrcode import DataTooLongError
4+
from .rmqrcode import IllegalVersionError
45
from .qr_image import QRImage
56
from .format.error_correction_level import ErrorCorrectionLevel
File renamed without changes.

tests/rmqrcode_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from rmqrcode import rMQR
2+
from rmqrcode import ErrorCorrectionLevel
3+
from rmqrcode import DataTooLongError
4+
from rmqrcode import IllegalVersionError
5+
6+
import pytest
7+
8+
9+
class TestRMQR:
10+
def test_fit(self):
11+
qr = rMQR.fit("abc")
12+
13+
def test_make(self):
14+
qr = rMQR('R13x99', ErrorCorrectionLevel.M)
15+
qr.make("abc")
16+
17+
def test_raise_too_long_error(self):
18+
with pytest.raises(DataTooLongError) as e:
19+
s = "a".ljust(200, "a")
20+
rMQR.fit(s)
21+
22+
def test_raise_invalid_version_error(self):
23+
with pytest.raises(IllegalVersionError) as e:
24+
qr = rMQR("not exists", ErrorCorrectionLevel.M)

0 commit comments

Comments
 (0)