我的vim配置有问题...
打开python(.py)文件时会发生此错误:
Error detected while processing BufRead Auto commands for "*.py":
E20: Mark not set
Run Code Online (Sandbox Code Playgroud)
打开例如html(.html)或ruby(.rb)文件时,不会发生错误.
这是我的vim配置.插件全部安装完毕.
""" VUNDLE """
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
" plugins
Plugin 'valloric/youcompleteme'
Plugin 'scrooloose/nerdtree'
Plugin 'jistr/vim-nerdtree-tabs'
Plugin 'shawncplus/phpcomplete.vim'
Plugin 'quramy/tsuquyomi'
"Plugin 'Shougo/vimproc.vim'
Plugin 'leafgarland/typescript-vim'
call vundle#end()
filetype plugin indent on
""" CONFIG """
set history=200 "command history
set so=7 "add 7 lines when moving up/down
set hlsearch "highlight search results
set showmatch "highlight matching brackets
set ruler
set …Run Code Online (Sandbox Code Playgroud) 我对angular2有疑问.我正在创建一些组件,并希望有这样的东西:
这是我的DogComponent类:
@Component({
selector: "dog",
template: "dog.template.html"
})
class DogComponent
{
@Input() image: string;
}
Run Code Online (Sandbox Code Playgroud)
以及dog.template.html中的模板:
<div>
<!-- Content of <top> should go here -->
<img class="after" src="dogs/{{image}}" />
<!-- Content of <bottom> should go here -->
</div>
Run Code Online (Sandbox Code Playgroud)
当我使用DogComponent,它应该创建IMG标签与传递的SRC,但在此之前和之后的图像还可以查看其他HTML部分.
所以最后,如果我写这段代码:
<dog image="garry.png">
<top>
<h1>This is Garry!</h1>
</top>
<bottom>
<span>He is my favorite dog!</span>
</bottom>
</dog>
Run Code Online (Sandbox Code Playgroud)
它应该呈现给:
<dog>
<div>
<h1>This is Garry!</h1>
<img src="dog.png" />
<span>He is my favorite dog!</span>
</div>
</dog>
Run Code Online (Sandbox Code Playgroud)
有人有我的问题的答案吗?
这会很棒!
编辑:
感谢您的建议,所以现在我更新了我的片段并添加了DogListComponent.如果我dog-list在应用程序的某处使用标记,则应查看最后一个片段(浏览器结果).希望它现在有点清晰了.
dog.component.ts …
我有一个关于在angular2中测试路由组件的问题.
这是一个简单的组件,它取决于带参数的路由'foo'.foo组件中的属性将设置为参数的值.
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
@Component({
selector: 'my-component',
templateUrl: './my-component.html'
})
export class MyComponent implements OnInit
{
foo: string;
constructor(
private route: ActivatedRoute
)
{
}
ngOnInit()
{
this.route.params.subscribe((params: Params) => {
this.foo = params['foo'];
});
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想测试一下,如果使用路径创建组件,则将正确设置param.所以我想要的地方expect(component.foo).toBe('3');.
import {TestBed, ComponentFixture, async} from '@angular/core/testing';
import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {Params, ActivatedRoute} from '@angular/router';
import {Observable} from 'rxjs';
import {MyComponent} from './MyComponent';
describe('MyComponent', …Run Code Online (Sandbox Code Playgroud) 在我的项目教练中,我在测试信息序列化程序时遇到了问题。我在文件中有以下序列化程序类running/serializes.py:
class Velocity(serializers.ModelSerializer):
class Meta:
model = VelocityModel
fields = ("id", "minimum", "average", "maximum")
class Information(serializers.ModelSerializer):
heart_beat = HeartBeat(read_only=True)
velocity = Velocity(read_only=True)
class Meta:
model = InformationModel
fields = ("id", "distance", "velocity", "heart_beat", "calories")
Run Code Online (Sandbox Code Playgroud)
在我的测试中,我有这个:
from running import models, serializers
@patch("running.serializers.Velocity")
def test_contains_id(self, mock_velocity):
# mocking stuff
returned_data = {}
mock_velocity.data = PropertyMock(return_value=returned_data)
# creating instances of the models
self.velocity = models.Velocity(minimum=8, average=10, maximum=12)
self.velocity.save()
self.heart_beat = models.HeartBeat(minimum=120, average=130, maximum=140)
self.heart_beat.save()
self.information = models.Information(distance=3.7, velocity=self.velocity, heart_beat=self.heart_beat, …Run Code Online (Sandbox Code Playgroud)