我已经阅读了有关使用TestBed测试Ionic2项目的文章,当我试图在我的环境中重复示例时,我遇到了麻烦.当我尝试在第3步开始测试时,出现错误"StatusBar没有提供者".
可能这是一个愚蠢的问题,但有人可能会想到它为什么会发生?
StatusBar包含(导入)在我的app.component.ts文件中.
import { StatusBar } from '@ionic-native/status-bar';
Run Code Online (Sandbox Code Playgroud) 我可以在 Python 中以支持/尊重/理解其所有者的继承层次结构的方式实现通用描述符吗?
在代码中应该更清楚:
from typing import (
Generic, Optional, TYPE_CHECKING,
Type, TypeVar, Union, overload,
)
T = TypeVar("T", bound="A") # noqa
class Descr(Generic[T]):
@overload
def __get__(self: "Descr[T]", instance: None, owner: Type[T]) -> "Descr[T]": ...
@overload
def __get__(self: "Descr[T]", instance: T, owner: Type[T]) -> T: ...
def __get__(self: "Descr[T]", instance: Optional[T], owner: Type[T]) -> Union["Descr[T]", T]:
if instance is None:
return self
return instance
class A:
attr: int = 123
descr = Descr[T]() # I want to bind T here, …Run Code Online (Sandbox Code Playgroud)