Improved typing in query

This commit is contained in:
2023-04-04 14:42:43 +02:00
parent 01309e3124
commit 5d6e7677de
3 changed files with 12 additions and 3 deletions

View File

@@ -270,6 +270,12 @@ class IterableQueryTestCase(unittest.TestCase):
self.assertEqual(res.to_list(), l_res)
def test_select(self):
def test(_l: List) -> List[int]:
return _l.select(lambda user: user.address.nr)
self.assertEqual(List[User], self._tests.type)
self.assertEqual(List[int], test(self._tests).type)
range_list = List(int, range(0, 100))
selected_range = range_list.select(lambda x: x + 1)