How to use 'python if boolean' in Python

Every line of 'python if boolean' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
313def test_is_bool(self):
314 output = self.run('''
315 echo is_bool(0), is_bool(0.0), is_bool(NULL), is_bool(array());
316 echo is_bool(FALSE), is_bool(TRUE), is_bool("foo");
317 ''')
318 assert [i.boolval for i in output] == [False, False, False, False,
319 True, True, False]

Related snippets