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/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8.18", "3.9.25", "3.10.18", "3.11.14", "3.12.12", "3.13.11", "3.14.2"]
python-version: ["3.9.25", "3.10.18", "3.11.14", "3.12.12", "3.13.11", "3.14.2"]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
:alt: Unittest Completion Status
.. |badge2| image:: https://raw.githubusercontent.com/robabram/python-easy-json/coverage-badge/coverage.svg?raw=true
:alt: Code Coverage Status
.. |badge3| image:: https://img.shields.io/badge/python-v3.8%20|%20v3.9%20|%20v3.10%20|%20v3.11%20|%20v3.12%20|%20v3.13%20|%20v3.14-blue
:alt: Python v3.8, v3.9, v3.10, v3.11, v3.12, v3.13, v3.14
.. |badge3| image:: https://img.shields.io/badge/python-v3.9%20|%20v3.10%20|%20v3.11%20|%20v3.12%20|%20v3.13%20|%20v3.14-blue
:alt: Python v3.9, v3.10, v3.11, v3.12, v3.13, v3.14


****************************************************************************************
Expand Down
2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
30 changes: 29 additions & 1 deletion tests/test_json_with_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# This file is subject to the terms and conditions defined in the
# file 'LICENSE', which is part of this source code package.
#
from typing import List
import json
from typing import List, Optional

from tests.base_test import BaseTestCase
from python_easy_json import JSONObject
Expand Down Expand Up @@ -34,3 +35,30 @@ def test_data_with_lists(self):
for i in obj.integer_list:
self.assertIsInstance(i, int)
self.assertIn(i, [1, 2, 3])

def test_nested_lists(self):
""" User supplied unittest for issue #25 """
class RR(JSONObject):
values: Optional[list[int]] # here list is okay

class P(JSONObject):
R: List[RR] # here list cannot be used

class Q(JSONObject):
W: List[P] # and here too

class P2(JSONObject):
R: List[RR] # here list cannot be used

class Q2(JSONObject):
W: List[P] # and here too

data = json.loads('{"W": [{"R": [{"values": [1, 2, 3]}]}]}')
# OK
x = Q(data)
self.assertIsInstance(x, Q)

# list() takes no keyword arguments
data = json.loads('{"W": [{"R": [{"values": [1, 2, 3]}]}]}')
x2 = Q2(data)
self.assertIsInstance(x2, Q2)