Skip to content

Commit

Permalink
Add regression test from typeddjango#2304
Browse files Browse the repository at this point in the history
  • Loading branch information
flaeppe committed Aug 1, 2024
1 parent dbe26ae commit 3366841
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/typecheck/managers/test_managers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -674,3 +674,65 @@
from django.db import models
class MyModel(models.Model): ...
# Regression test for #2304
- case: test_objects_managers_is_kept_with_specific_import_graph
main: |
from zerver.models import RealmFilter
reveal_type(RealmFilter.objects)
installed_apps:
- django.contrib.auth
- django.contrib.contenttypes
- confirmation
- zerver
files:
- path: confirmation/__init__.py
- path: confirmation/models.py
content: |
from django.db import models
from zerver.models import Realm
class Confirmation(models.Model):
realm = models.ForeignKey(Realm, on_delete=models.CASCADE)
- path: zerver/__init__.py
- path: zerver/models/__init__.py
content: |
from zerver.models.linkifiers import RealmFilter as RealmFilter
from zerver.models.realms import Realm as Realm
from zerver.models.streams import Stream as Stream
from zerver.models.users import UserProfile as UserProfile
RealmFilter.objects
- path: zerver/models/linkifiers.py
content: |
from django.db import models
class RealmFilter(models.Model):
pass
- path: zerver/models/realms.py
content: |
from django.db import models
class Realm(models.Model):
pass
- path: zerver/models/streams.py
content: |
from django.db import models
from zerver.models.realms import Realm
from zerver.models.users import UserProfile
class Stream(models.Model):
realm = models.ForeignKey(Realm, on_delete=models.RESTRICT)
creator = models.ForeignKey(UserProfile, on_delete=models.RESTRICT)
- path: zerver/models/users.py
content: |
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
class UserProfile(AbstractBaseUser, PermissionsMixin):
pass

0 comments on commit 3366841

Please sign in to comment.