Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail From: ram@zedat.fu-berlin.de (Stefan Ram) Newsgroups: comp.lang.python Subject: Re: Feature proposal: unittest.mock.NAN Date: 24 Jan 2024 20:34:01 GMT Organization: Stefan Ram Lines: 16 Expires: 1 Dec 2024 11:59:58 GMT Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de mHD6QptE5br30ywAvtgxqQVg77R7/Q0k/YT2Pf89S4EHis Cancel-Lock: sha1:hg8WKjfN4alwlQ7+iEEXVFLGwj8= sha256:8XWQxDu+a+tioh6nbMHhzoRtmxgIBQorcjr8bxAKKHM= X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed. X-No-Archive: Yes Archive: no X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access. X-No-Html: yes Content-Language: en-US Accept-Language: de-DE-1901, en-US, it, fr-FR Kerrick Staley writes: > NaNs are special in that math.nan != math.nan, so you can't just do >assert_called_with(math.nan). >>> class ProductionClass: .... def method(self): .... self.something( math.nan ) .... def something( self, x ): .... pass .... >>> real = ProductionClass() >>> real.something = MagicMock() >>> real.method() >>> real.something.assert_called_once_with( math.nan ) >>>