Skip to content

qb: assert_single (and similar) fail in typing_dispatch #897

@msullivan

Description

@msullivan
        from models.orm import default, std

        # Combine update and select of the updated object
        res = self.client.get(
            default.Post.filter(body="Hello")
            .update(
                author=std.assert_single(default.User.filter(name="Billie"))
            )
            .select("*", author=lambda p: p.author.select("**"))
        )

        self.assertEqual(res.body, "Hello")
        self.assertEqual(res.author.name, "Zoe")
        self.assertEqual({g.name for g in res.author.groups}, {"redgreen"})

produces

  File "/home/sully/src/e/edgedb-python/tests/test_qb.py", line 647, in test_qb_update_03
    author=std.assert_single(default.User.filter(name="Billie"))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_typing_dispatch.py", line 230, in __call__
    return self._call(None, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_typing_dispatch.py", line 273, in _call
    if not _isinstance(arg, pt):
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_typing_dispatch.py", line 69, in _isinstance
    return any(issubclass(c, args[0]) for c in genalias_mro)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sully/src/e/edgedb-python/gel/_internal/_typing_dispatch.py", line 69, in <genexpr>
    return any(issubclass(c, args[0]) for c in genalias_mro)
               ^^^^^^^^^^^^^^^^^^^^^^
TypeError: issubclass() arg 2 must be a class, a tuple of classes, or a union

the RHS of the failing issubclass call is ~_T_anytype.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions