autoformat with pyupgrade
This commit is contained in:
@@ -168,7 +168,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
def __unicode__(self):
|
||||
return self.title
|
||||
|
||||
doc = Article(title=u"привет мир")
|
||||
doc = Article(title="привет мир")
|
||||
|
||||
assert "<Article: привет мир>" == repr(doc)
|
||||
|
||||
@@ -181,7 +181,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
def __str__(self):
|
||||
return None
|
||||
|
||||
doc = Article(title=u"привет мир")
|
||||
doc = Article(title="привет мир")
|
||||
assert "<Article: None>" == repr(doc)
|
||||
|
||||
def test_queryset_resurrects_dropped_collection(self):
|
||||
@@ -521,9 +521,9 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
query_op = q.db.system.profile.find({"ns": "mongoenginetest.animal"})[0]
|
||||
assert query_op["op"] == "update"
|
||||
if mongo_db <= MONGODB_34:
|
||||
assert set(query_op["query"].keys()) == set(["_id", "is_mammal"])
|
||||
assert set(query_op["query"].keys()) == {"_id", "is_mammal"}
|
||||
else:
|
||||
assert set(query_op["command"]["q"].keys()) == set(["_id", "is_mammal"])
|
||||
assert set(query_op["command"]["q"].keys()) == {"_id", "is_mammal"}
|
||||
|
||||
Animal.drop_collection()
|
||||
|
||||
@@ -546,7 +546,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
query_op = q.db.system.profile.find({"ns": "mongoenginetest.animal"})[0]
|
||||
assert query_op["op"] == "command"
|
||||
assert query_op["command"]["findAndModify"] == "animal"
|
||||
assert set(query_op["command"]["query"].keys()) == set(["_id", "is_mammal"])
|
||||
assert set(query_op["command"]["query"].keys()) == {"_id", "is_mammal"}
|
||||
|
||||
Animal.drop_collection()
|
||||
|
||||
@@ -1428,11 +1428,11 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
coll = self.Person._get_collection()
|
||||
doc = self.Person(name="John").save()
|
||||
raw_doc = coll.find_one({"_id": doc.pk})
|
||||
assert set(raw_doc.keys()) == set(["_id", "_cls", "name"])
|
||||
assert set(raw_doc.keys()) == {"_id", "_cls", "name"}
|
||||
|
||||
doc.update(rename__name="first_name")
|
||||
raw_doc = coll.find_one({"_id": doc.pk})
|
||||
assert set(raw_doc.keys()) == set(["_id", "_cls", "first_name"])
|
||||
assert set(raw_doc.keys()) == {"_id", "_cls", "first_name"}
|
||||
assert raw_doc["first_name"] == "John"
|
||||
|
||||
def test_inserts_if_you_set_the_pk(self):
|
||||
@@ -2041,7 +2041,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
assert promoted_employee.details is None
|
||||
|
||||
def test_object_mixins(self):
|
||||
class NameMixin(object):
|
||||
class NameMixin:
|
||||
name = StringField()
|
||||
|
||||
class Foo(EmbeddedDocument, NameMixin):
|
||||
@@ -2055,7 +2055,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
assert ["id", "name", "widgets"] == sorted(Bar._fields.keys())
|
||||
|
||||
def test_mixin_inheritance(self):
|
||||
class BaseMixIn(object):
|
||||
class BaseMixIn:
|
||||
count = IntField()
|
||||
data = StringField()
|
||||
|
||||
@@ -2929,7 +2929,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
|
||||
# $Where
|
||||
assert (
|
||||
u",".join(
|
||||
",".join(
|
||||
[
|
||||
str(b)
|
||||
for b in Book.objects.filter(
|
||||
@@ -3303,7 +3303,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
for node_name, node in self.nodes.items():
|
||||
node.expand()
|
||||
node.save(*args, **kwargs)
|
||||
super(NodesSystem, self).save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
NodesSystem.drop_collection()
|
||||
Node.drop_collection()
|
||||
@@ -3752,7 +3752,7 @@ class TestDocumentInstance(MongoDBTestCase):
|
||||
_ = list(Jedi.objects) # Ensure a proper document loads without errors
|
||||
|
||||
# Forces a document with a wrong shape (may occur in case of migration)
|
||||
value = u"I_should_be_a_dict"
|
||||
value = "I_should_be_a_dict"
|
||||
coll.insert_one({"light_saber": value})
|
||||
|
||||
with pytest.raises(InvalidDocumentError) as exc_info:
|
||||
@@ -3819,7 +3819,7 @@ class ObjectKeyTestCase(MongoDBTestCase):
|
||||
|
||||
class DBFieldMappingTest(MongoDBTestCase):
|
||||
def setUp(self):
|
||||
class Fields(object):
|
||||
class Fields:
|
||||
w1 = BooleanField(db_field="w2")
|
||||
|
||||
x1 = BooleanField(db_field="x2")
|
||||
|
||||
Reference in New Issue
Block a user