diff --git a/.gitignore b/.gitignore index 757fee3..7f1e10f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -/.idea \ No newline at end of file +/.idea +/dist +/src/btoa.egg-info +/venv +__pycache__ \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1448189 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "btoa" +version = "1.0" +authors = [ + { name="LazyDeus", email="dimaprodeus@yandex.ru" }, +] +description = "Python implementation btoa and atob functions from javascript" +requires-python = ">=3.6" +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", +] + +[project.urls] +"Homepage" = "https://github.com/Demetrous-fd/btoa" +"Bug Tracker" = "https://github.com/Demetrous-fd/btoa/issues" \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 9719db5..0000000 --- a/setup.py +++ /dev/null @@ -1,13 +0,0 @@ -from setuptools import setup - -setup( - name='btoa', - version='1.0', - description='Python implementation btoa and atob functions from javascript', - url='https://github.com/Demetrous-fd/btoa', - author='LazyDeus', - author_email='dimaprodeus@yandex.ru', - license='MIT', - packages=['mypackage'], - zip_safe=False -) diff --git a/__init__.py b/src/btoa/__init__.py similarity index 100% rename from __init__.py rename to src/btoa/__init__.py diff --git a/main.py b/src/btoa/main.py similarity index 100% rename from main.py rename to src/btoa/main.py diff --git a/tests/main.py b/tests/main.py new file mode 100644 index 0000000..f37171e --- /dev/null +++ b/tests/main.py @@ -0,0 +1,25 @@ +from unittest import TestCase + +from btoa import btoa, atob + + +class MainCase(TestCase): + def test_btoa(self): + self.assertEqual( + btoa("Hello World"), + "SGVsbG8gV29ybGQ=" + ) + self.assertEqual( + btoa('s8ë{LóüÈ@É"¹ÏLôa"¢f#½2r[¢ÀCwÀ¯ÅaõdUí£tùºm94±]!'), + "czjre0zz/MhAySK5z0z0YSKiZiO9MnJbosBDd8CvxWH1ZFXto3T5um05NLFdIQ==" + ) + + def test_atob(self): + self.assertEqual( + atob("SGVsbG8gV29ybGQ="), + "Hello World" + ) + self.assertEqual( + atob("czjre0zz/MhAySK5z0z0YSKiZiO9MnJbosBDd8CvxWH1ZFXto3T5um05NLFdIQ=="), + 's8ë{LóüÈ@É"¹ÏLôa"¢f#½2r[¢ÀCwÀ¯ÅaõdUí£tùºm94±]!' + )