y700@y700-Lenovo-ideapad-Y700-15ISK:~/projects/WEB_practic$ python2 selectors.py
Traceback (most recent call last):
File "selectors.py", line 1, in <module>
import selectors
File "/home/y700/projects/WEB_practic/selectors.py", line 4, in <module>
selector = selectors.DefaultSelector()
AttributeError: 'module' object has no attribute 'DefaultSelector'
--> 55 final_inputs = np.dot(self.who, hidden_outputs)
56 #расчитать исходящие сигналы для выходного слоя
57 final_outputs = self.activation_function(final_inputs)
ValueError: shapes (10,784) and (100,1) not aligned: 784 (dim 1) != 100 (dim 0)
app.config.from_object('config.TestingConfig')
class TestingConfig(Configuration):
TESTING = True
SQLALCHEMY_DATABASE_URI = 'postgresql://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s' % TEST_POSTGRES
DEBUG = False
from flask import Flask
import unittest
from app import app
from images.models import Images, ImageGroup
from flask_sqlalchemy import SQLAlchemy
class FlaskTestCase(unittest.TestCase):
def setUp(self):
app.config.from_object('config.TestingConfig')
self.db = SQLAlchemy(app)
self.db.create_all()
im_group = ImageGroup()
self.db.session.add(im_group)
self.db.session.commit()
image = Images(img_filename='test.jpg', counter=1, img_data='tests', imagegroup_id=im_group.id)
self.db.session.add(image)
self.db.session.commit()
def tearDown(self):
self.db.session.remove()
self.db.drop_all()
pass
def test_model_exist(self):
self.assertTrue(self.db.session.query(Images).filter(Images.img_filename == 'test.jpg').first() is not None)
pass
File "test.py", line 26, in setUp
self.db.create_all()
File "/home/y700/Env/bee_ml/lib/python3.6/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: database "db" does not exist
from flask import Flask
import unittest
from app import db, app
from images.models import Images, ImageGroup
class FlaskTestCase(unittest.TestCase):
def create_app(self):
app.config.from_object('config.TestingConfig')
return app
def setUp(self):
db.create_all()
im_group = ImageGroup()
db.session.add(im_group)
db.session.commit()
image = Images(img_filename='test.jpg', counter=1, img_data='tests', imagegroup_id=im_group.id)
db.session.add(image)
db.session.commit()
def tearDown(self):
db.session.remove()
db.drop_all()
def test_model_exist(self):
self.assertTrue(db.session.query(Images).filter(Images.img_filename == 'test.jpg').first() is not None)
pass
if __name__ == "__main__":
unittest.main()