Skip to content

Commit aba3040

Browse files
author
Villiers Strauss
committed
UUIDField is only available in Django>=1.8
1 parent eec01ff commit aba3040

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

test/input/func_noerror_model_fields.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class LotsOfFieldsModel(models.Model):
3434
textfield = models.TextField()
3535
timefield = models.TimeField()
3636
urlfield = models.URLField()
37-
uuidfield = models.UUIDField()
3837

3938
def boolean_field_tests(self):
4039
print(self.booleanfield | True)
@@ -80,12 +79,3 @@ def numberfield_tests(self):
8079
print(self.smallintegerfield + 3)
8180
print(self.positiveintegerfield + 2)
8281
print(self.positivesmallintegerfield + 1)
83-
84-
def uuidfield_tests(self):
85-
print(self.uuidfield.bytes)
86-
print(self.uuidfield.bytes_le)
87-
print(self.uuidfield.fields[2])
88-
print(self.uuidfield.hex)
89-
# print(self.uuidfield.int) # Don't know how to properly check this one
90-
print(self.uuidfield.variant)
91-
print(self.uuidfield.version)

test/input/func_noerror_uuid_field.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""
2+
Checks that Pylint does not complain about UUID fields.
3+
"""
4+
# pylint: disable=C0111,W5101
5+
from __future__ import print_function
6+
from django.db import models
7+
8+
9+
class LotsOfFieldsModel(models.Model):
10+
uuidfield = models.UUIDField()
11+
12+
def uuidfield_tests(self):
13+
print(self.uuidfield.bytes)
14+
print(self.uuidfield.bytes_le)
15+
print(self.uuidfield.fields[2])
16+
print(self.uuidfield.hex)
17+
# print(self.uuidfield.int) # Don't know how to properly check this one
18+
print(self.uuidfield.variant)
19+
print(self.uuidfield.version)

test/test_func.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
SKIP_TESTS_FOR_DJANGO_VERSION = {
2525
# if the second value is False, skip the test, otherwise run it
2626
('func_noerror_protected_meta_access', django_version >= (1, 8)),
27+
('func_noerror_uuid_field', django_version >= (1, 8)),
2728
}
2829

2930

0 commit comments

Comments
 (0)