这是我的错误代码:
FAIL build/__test__/FuncOps.CheckFunctionExistenceByString.test.js
?
expect(CheckFunctionExistenceByStr(
'any string', 'FunctionThatDoesNotExistsInString'
)).toThrow();
Function FunctionThatDoesNotExistsInString does not exists in string.
at CheckFunctionExistenceByStr (build/FuncOps.js:35:15)
at Object.<anonymous> (build/__test__/FuncOps.CheckFunctionExistenceByString.test.js:12:51)
at new Promise (<anonymous>)
at <anonymous>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,确实发生了错误:Function FunctionThatDoesNotExistsInString does not exists in string..然而,它并没有被捕获为Jest中的传球.
这是我的代码:
test(`
expect(CheckFunctionExistenceByStr(
'any string', 'FunctionThatDoesNotExistsInString'
)).toThrow();
`, () => {
expect(CheckFunctionExistenceByStr(
'any string', 'FunctionThatDoesNotExistsInString'
)).toThrow();
}
);
Run Code Online (Sandbox Code Playgroud) 我收到这个错误.
AttributeError: module 'cv2' has no attribute 'CV_HAAR_SCALE_IMAGE'
Run Code Online (Sandbox Code Playgroud)
将我的OpenCV升级到3.1.0后.我试过这些.
cv2.cv.CV_HAAR_SCALE_IMAGE
Run Code Online (Sandbox Code Playgroud)
还有这个.
cv2.CV_HAAR_SCALE_IMAGE
Run Code Online (Sandbox Code Playgroud)
但仍然是同样的错误.我去了这里,http://docs.opencv.org/3.1.0/d9/d31/group__objdetect__c.html#ga812f46d031349fa2ee78a5e7240f5016但我找不到常量存储在哪个对象的任何信息.
我试图删除PostgreSQL用户:
DROP USER ryan;
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
Run Code Online (Sandbox Code Playgroud)Error in query: ERROR: role "ryan" cannot be dropped because some objects depend on it DETAIL: privileges for database mydatabase
我从这些线程中寻找解决方案:
还是有同样的错误.
在我向用户"ryan"授予所有权限后,会发生这种情况:
GRANT ALL PRIVILEGES ON DATABASE mydatabase ON SCHEMA public TO ryan;
Run Code Online (Sandbox Code Playgroud) 好吧,我有一个名为<TestButton />. 在里面<TestButton />有两个 Semantic UI React 组件,<Button />和<Header>.
基本上,当<Button>单击 时,它会切换display: none;到<Header>。
我想检查(我想学习)如何断言<Header>'s display: none;when<Button>被点击。
测试按钮.js
const TestButton = (props) => {
return (
<div id='test-button'>
<Header id='please-hide-me' size='huge'>Please Hide Me</Header>
<Button
onClick={
() => {
hiding = !hiding;
let findDOM = document.getElementById(searchForThisID);
if (findDOM) { findDOM.style.display = hiding ? 'none' : ''; }
return hiding;
}
}
>
Sample Toggle …Run Code Online (Sandbox Code Playgroud) version: '2'
services:
web:
build:
context: ./
dockerfile: deploy/web.docker
volumes:
- ./:/var/www
ports:
- "8080:80"
links:
- app
Run Code Online (Sandbox Code Playgroud)
chmod何时自动更改权限()/ var / www docker-compose up -d --build?
在 Laravel 中,它可以像这里描述的那样简单地完成:https ://laravel.com/docs/5.6/eloquent-resources 。
有人说,API 资源不适合 Lumen。但是,就这个问题而言,我想知道,严格来说,是否有办法在 Lumen 项目中添加 Laravel JSON API 资源(use Illuminate\Http\Resources\Json\JsonResource;新创建的 Lumen 项目中缺少该包)。
现在我有这个代码来检查 Eloquent 模型连接到哪个表。
$s = new Something();
dd($s->getTable());
Run Code Online (Sandbox Code Playgroud)
无论如何我可以在不实例化新Something对象的情况下获得表?
我在想像这样的代码:
Something::getTable();
Run Code Online (Sandbox Code Playgroud)
但是会有..should not be called statically误差。
我目前正在使用它self.assertTrue(True)来通过测试。我想要的是如果出现特定警告则通过测试。
import warnings
class test(unittest.TestCase):
def test_1(self):
with warning.catch_warnings(record=False):
warning.simplefilter("error", category=CustomWarning)
try: function_that_raisesCustomWarning()
except CustomWarning as w: self.assertTrue(True)
Run Code Online (Sandbox Code Playgroud) 这是我可以使用的基本NGINX设置!
web:
image: nginx
volumes:
- ./nginx:/etc/nginx/conf.d
....
Run Code Online (Sandbox Code Playgroud)
我将volumes复制./nginx到/etc/nginx/conf.d使用替换COPY ./nginx /etc/nginx/conf.d到我的容器中。问题是因为通过使用值nginx.conf引用了主机中的日志文件而不是容器中的日志文件。因此,我认为通过将配置文件硬拷贝到容器中可以解决我的问题。
但是,NGINX根本没有运行docker compose up。怎么了?
编辑:
Docker文件
FROM python:3-onbuild
COPY ./ /app
COPY ./nginx /etc/nginx/conf.d
RUN chmod +x /app/start_celerybeat.sh
RUN chmod +x /app/start_celeryd.sh
RUN chmod +x /app/start_web.sh
RUN pip install -r /app/requirements.txt
RUN python /app/manage.py collectstatic --noinput
RUN /app/automation/rm.sh
Run Code Online (Sandbox Code Playgroud)
docker-compose.yml
version: "3"
services:
nginx:
image: nginx:latest
container_name: nginx_airport
ports:
- "8080:8080"
rabbit:
image: rabbitmq:latest
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=asdasdasd
ports:
- …Run Code Online (Sandbox Code Playgroud) 我正在使用Laravel创建RESTFUL应用程序,并使用Postman测试该应用程序。当前,PATCH或者PUT从Postman发送的带有表单数据的数据是否存在问题。
// Parameter `{testimonial}` will be sent to backend.
Route::post ('testimonials/{testimonial}', 'TestimonialController@update');
// Parameter `{testimonial}` will not be sent to backend (`$request->all()` will be empty) if sent from Postman with form-data.
Route::patch ('testimonials/{testimonial}', 'TestimonialController@update');
Route::put ('testimonials/{testimonial}', 'TestimonialController@update');
Run Code Online (Sandbox Code Playgroud)
$request->all()可以POST。$request->all()会好起来的PATCH,PUT和POST。PUT并PATCH使用表单数据,则$request->all()它将为空(参数将不会发送到后端)。现在,解决方案是POST用于更新模型。我想知道为什么PATCH和PUTPostman的表单数据一起发送时不起作用。
laravel ×3
php ×3
docker ×2
javascript ×2
jestjs ×2
lumen ×2
python ×2
unit-testing ×2
devops ×1
ecmascript-6 ×1
eloquent ×1
enzyme ×1
http ×1
nginx ×1
opencv ×1
postgresql ×1
postman ×1
reactjs ×1
roles ×1
warnings ×1