StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics
https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.2 KiB
33 lines
1.2 KiB
from werkzeug.exceptions import HTTPException
|
|
|
|
from flask_pymongo.tests.util import FlaskPyMongoTest
|
|
|
|
|
|
class CollectionTest(FlaskPyMongoTest):
|
|
|
|
def test_find_one_or_404(self):
|
|
self.mongo.db.things.delete_many({})
|
|
|
|
try:
|
|
self.mongo.db.things.find_one_or_404({"_id": "thing"})
|
|
except HTTPException as notfound:
|
|
assert notfound.code == 404, "raised wrong exception"
|
|
|
|
self.mongo.db.things.insert_one({"_id": "thing", "val": "foo"})
|
|
|
|
# now it should not raise
|
|
thing = self.mongo.db.things.find_one_or_404({"_id": "thing"})
|
|
assert thing["val"] == "foo", "got wrong thing"
|
|
|
|
# also test with dotted-named collections
|
|
self.mongo.db.things.morethings.delete_many({})
|
|
try:
|
|
self.mongo.db.things.morethings.find_one_or_404({"_id": "thing"})
|
|
except HTTPException as notfound:
|
|
assert notfound.code == 404, "raised wrong exception"
|
|
|
|
self.mongo.db.things.morethings.insert_one({"_id": "thing", "val": "foo"})
|
|
|
|
# now it should not raise
|
|
thing = self.mongo.db.things.morethings.find_one_or_404({"_id": "thing"})
|
|
assert thing["val"] == "foo", "got wrong thing"
|
|
|