我有 3 个源文件 File1.ts、File2.ts、File3.ts。在执行 File3 的单元测试时,我收到以下错误。
Test suite failed to run
ReferenceError: Cannot access 'mockMethod1' before initialization
20 | __esModule: true,
21 | default: jest.fn(),
> 22 | method1: mockMethod1,
| ^
23 | method2: mockMethod2
24 | }));
25 |
Run Code Online (Sandbox Code Playgroud)
以下是 File3 的 3 个源文件和单元测试的内容。
文件1.ts
export default class File1 {
public element;
constructor(element) {
this.element = element;
}
method1(inputs) {
// Logic of Method1.
return output;
}
method2(inputs) {
// Logic of Method2.
return output;
}
}
Run Code Online (Sandbox Code Playgroud)
文件2.ts …
我的左框架中有 4 个按钮,我希望它们在我调整大小时也能调整大小
我的窗口,但它不起作用,当我扩展窗口时,按钮没有扩展
下面是我的代码
from tkinter import *
root = Tk()
leftFrame = Frame(root)
leftFrame.pack(side=LEFT)
rightFrame = Frame(root)
rightFrame.pack(side=RIGHT)
button1 = Button(leftFrame,text="Round 1",fg="white",bg="black")
button2 = Button(leftFrame,text="Round 2",fg="yellow",bg="blue")
button3 = Button(leftFrame,text="Round 3",fg="purple",bg="cyan")
button4 = Button(leftFrame,text="Round 4",fg="green",bg="orange")
button1.pack(expand=True,fill='both')
button2.pack(expand=True,fill='both')
button3.pack(expand=True,fill='both')
button4.pack(expand=True,fill='both')
root.mainloop()
Run Code Online (Sandbox Code Playgroud)
感谢帮助
我使用的是Python 3.5,编辑器是Pycharm