Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false # Changed to false to see all failures
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm ]
python-version: [ "3.8","3.9","3.10", "3.11","3.12", "3.13","3.14" ]
python-version: [ "3.8","3.9","3.10", "3.11","3.12", "3.13" ] # ToDo: add support for 3.14 when it's available in GitHub Actions

steps:
- uses: actions/checkout@v4
Expand Down
26 changes: 26 additions & 0 deletions pyxtension/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ class A(ExtModel):


class TestExtModel(TestCase):
def test_regression_on_pydantic(self):
class A(ExtModel):
ts: int

class B(A):
cf: float
a_list: List[A]
a_slist: slist[A]
a_dict: Dict[int, A]

@validator("a_slist")
def a_slist_validator(cls, v):
if not isinstance(v, slist):
return slist(v)
return v

expected = '{"ts": 20230412, "cf": 1.5, "a_list": [{"ts": 20230412}], "a_slist": [{"ts": 20230412}], "a_dict": {"1": {"ts": 20230412}}}'
d = json.loads(expected)
new_a = B(**d)
self.assertIsInstance(new_a.a_list, list)
self.assertIsInstance(new_a.a_list[0], A)
self.assertIsInstance(new_a.a_slist, slist)
self.assertIsInstance(new_a.a_slist[0], A)
self.assertIsInstance(new_a.a_dict, dict)
self.assertIsInstance(new_a.a_dict[1], A)

def test_to_from_json(self):
class CustomFloat(float, PydanticCoercingValidated):
pass
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
tqdm>=4.62.0;python_version>="3"
json-composite-encoder>=1.0.0
pydantic>=1.8.2;python_version>="3"
streamerate>=1.1.4
tblib>=1.7.0;python_version>="3"
json-composite-encoder>=1.0.0
streamerate>=1.0.0
throttlex>=1.0.0
throttlex>=1.0.0
tqdm>=4.62.0;python_version>="3"
24 changes: 9 additions & 15 deletions run_tests.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
#!/usr/bin/env python
# coding:utf-8
# Author: ASU --<andrei.suiu@gmail.com>
# Purpose:
# Purpose:
# Created: 11/5/2017
import os
import sys
import unittest
import io
__author__ = 'ASU'

if __name__ == '__main__':
__author__ = "ASU"

if __name__ == "__main__":
testLoader = unittest.TestLoader()
pymajorVersion = sys.version_info[0]
packageDir = os.path.join(os.path.dirname(__file__), "py%d" % pymajorVersion, "pyxtension")
testsDir = os.path.join(packageDir, "tests")
#sys.path.append(packageDir)
testsDir = os.path.join(os.path.dirname(__file__), "pyxtension", "tests")

# textTestResult = unittest.TextTestResult(io.StringIO(),'',verbosity=1)
trunner = unittest.TextTestRunner(sys.stdout, descriptions=True, verbosity=0)
trunner = unittest.TextTestRunner(sys.stdout, descriptions=True, verbosity=2)
testSuite = testLoader.discover(start_dir=testsDir, pattern="test_*.py", top_level_dir=testsDir)
res = trunner.run(testSuite)

testSuite = testLoader.discover(start_dir=testsDir, pattern="test_*.py", top_level_dir=testsDir)
testResult = unittest.TestResult()
res = testSuite.run(testResult)
assert not res.errors, "Unittests error: %s" % res.errors
print(res)
if res.failures or res.errors:
sys.exit(1)
sys.exit(0)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
__author__ = "ASU"

# Bump up this version
VERSION = "1.17.0"
VERSION = "1.17.1"

basedir = os.path.dirname(__file__)
dest_package_dir = join(basedir, "pyxtension")
Expand Down
2 changes: 1 addition & 1 deletion upload.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
del ./dist/*.whl
echo "Use --py2 option to build&upload py2 version"
python setup.py bdist_wheel %*
twine upload dist/*.whl -u asuiu --verbose
twine upload dist/*.whl --verbose
Loading