跳至內容
選單
此問題已被標幟
1 回覆
5580 瀏覽次數

I'm writing unit tests for my module and I'd like to do this simple check:

self.assertIs(self.board, wi.board_id)

but I get the aforementioned error. Though, self.assertEqual() works. Is it safe to use assertEqual() for such a test?

頭像
捨棄
最佳答案

assertEqual(a, b)     a == b     
assertIs(a, b)     a is b

So yes, It is safe use assertEquals. If hoy take a look to Odoo test, equals is used a lot.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
10月 23
1181
0
10月 23
1972
0
11月 20
2937
2
10月 23
2531
0
6月 23
3583