我看到这篇帖子后很兴奋地尝试了,但我无法让它发挥作用.试图保持这个简单只是为了弄清楚什么是错的,但即使这样也是失败的.
export class SomeService {
...
private _myValue: Boolean = false;
get myValue(): Boolean {
return this._myValue;
}
set myValue(helper: Boolean) {
this._myValue = helper;
}
Run Code Online (Sandbox Code Playgroud)
在我的单元测试中,我有:
it('should ', inject([SomeService], (someService: SomeService) => {
let oldValue = someService.myValue;
expect(oldValue).toBe(false); // passes, clearly we can use our getter
someService.myValue = true;
expect(someService.myValue).toBe(true); // passed, clearly the setter worked
spyOnProperty(someService, 'myValue', 'getter').and.returnValue(false); // Property myValue does not have access type getter
//spyOnProperty(someService, 'myValue', 'get').and.returnValue(false);same error if tried this way
expect(someService.myValue).toBe(false); …Run Code Online (Sandbox Code Playgroud) 我已经搜索了 pandas 文档和食谱,很明显您可以使用dataframe.columnName.round(decimalplace).
你如何用更大的数字做到这一点?
例如,我有一列房价,我希望它们四舍五入到最接近的 10000 或 1000 或其他。
df.SalesPrice.WhatDoIDo(1000)?
Run Code Online (Sandbox Code Playgroud)