mirror of
https://github.com/Xevion/phototag.git
synced 2025-12-05 23:15:43 -06:00
Add pytest, add basic byte conversion testing
This commit is contained in:
1
Pipfile
1
Pipfile
@@ -21,6 +21,7 @@ setuptools = "*"
|
||||
vistir = "==0.6.1"
|
||||
pipenv-setup = {extras = ["black"], version = "*"}
|
||||
black = "*"
|
||||
pytest = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.11"
|
||||
|
||||
26
Pipfile.lock
generated
26
Pipfile.lock
generated
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "e489f1d322f8c3fae1ef168460a4b8e7d433af359a03d9cff2bc7eec46e09d39"
|
||||
"sha256": "fb76cf9103131a075b19295af3f7203d705c624168b94378828bbfef97fc5ead"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@@ -770,6 +770,14 @@
|
||||
"markers": "python_version >= '3.5'",
|
||||
"version": "==3.4"
|
||||
},
|
||||
"iniconfig": {
|
||||
"hashes": [
|
||||
"sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3",
|
||||
"sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"
|
||||
],
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==2.0.0"
|
||||
},
|
||||
"mypy-extensions": {
|
||||
"hashes": [
|
||||
"sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d",
|
||||
@@ -861,6 +869,14 @@
|
||||
"markers": "python_version >= '3.7'",
|
||||
"version": "==0.4.4"
|
||||
},
|
||||
"pluggy": {
|
||||
"hashes": [
|
||||
"sha256:4224373bacce55f955a878bf9cfa763c1e360858e330072059e10bad68531159",
|
||||
"sha256:74134bbf457f031a36d68416e1509f34bd5ccc019f0bcc952c7b909d06b37bd3"
|
||||
],
|
||||
"markers": "python_version >= '3.6'",
|
||||
"version": "==1.0.0"
|
||||
},
|
||||
"pyparsing": {
|
||||
"hashes": [
|
||||
"sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb",
|
||||
@@ -869,6 +885,14 @@
|
||||
"markers": "python_version >= '3.1'",
|
||||
"version": "==3.0.9"
|
||||
},
|
||||
"pytest": {
|
||||
"hashes": [
|
||||
"sha256:3799fa815351fea3a5e96ac7e503a96fa51cc9942c3753cda7651b93c1cfa362",
|
||||
"sha256:434afafd78b1d78ed0addf160ad2b77a30d35d4bdf8af234fe621919d9ed15e3"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==7.3.1"
|
||||
},
|
||||
"python-dateutil": {
|
||||
"hashes": [
|
||||
"sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86",
|
||||
|
||||
5
setup.py
5
setup.py
@@ -85,7 +85,7 @@ setup(
|
||||
extras_require={
|
||||
"dev": [
|
||||
"attrs==23.1.0; python_version >= '3.7'",
|
||||
"black==22.12.0; python_version >= '3.6'",
|
||||
"black==22.12.0",
|
||||
"cached-property==1.5.2",
|
||||
"cerberus==1.3.4",
|
||||
"certifi==2023.5.7; python_version >= '3.6'",
|
||||
@@ -95,6 +95,7 @@ setup(
|
||||
"colorama==0.4.6; platform_system == 'Windows'",
|
||||
"distlib==0.3.6",
|
||||
"idna==3.4; python_version >= '3.5'",
|
||||
"iniconfig==2.0.0; python_version >= '3.7'",
|
||||
"mypy-extensions==1.0.0; python_version >= '3.5'",
|
||||
"orderedmultidict==1.0.1",
|
||||
"packaging==20.9; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
@@ -106,7 +107,9 @@ setup(
|
||||
"pipfile==0.0.2",
|
||||
"platformdirs==3.5.1; python_version >= '3.7'",
|
||||
"plette[validation]==0.4.4; python_version >= '3.7'",
|
||||
"pluggy==1.0.0; python_version >= '3.6'",
|
||||
"pyparsing==3.0.9; python_version >= '3.1'",
|
||||
"pytest==7.3.1",
|
||||
"python-dateutil==2.8.2; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
|
||||
"requests==2.30.0; python_version >= '3.7'",
|
||||
"requirementslib==1.6.9; python_version >= '3.7'",
|
||||
|
||||
12
tests/test_byte_conversion.py
Normal file
12
tests/test_byte_conversion.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from phototag.helpers import convert_to_bytes
|
||||
|
||||
|
||||
def test_basic():
|
||||
assert convert_to_bytes("1 Kb") == 128
|
||||
assert convert_to_bytes("1Mb") == 1024 ** 2 / 8
|
||||
assert convert_to_bytes("1 KB") == 1024
|
||||
assert convert_to_bytes("1 MB") == 1024 ** 2
|
||||
assert convert_to_bytes("1 KiB") == 1024
|
||||
assert convert_to_bytes("1TiB") == 1024 ** 4
|
||||
assert convert_to_bytes("1Tib") == 1024 ** 4 / 8
|
||||
assert convert_to_bytes("1tib") == 1000 ** 4 / 8
|
||||
Reference in New Issue
Block a user