Tests
builtin¶
Name | Description |
---|---|
odd | Return true if the variable is odd. |
even | Return true if the variable is even. |
divisibleby | Check if a variable is divisible by a number. |
defined | Return true if the variable is defined: |
undefined | Like :func:defined but the other way round. |
filter | Check if a filter exists by name. Useful if a filter may be |
test | Check if a test exists by name. Useful if a test may be |
none | Return true if the variable is none. |
boolean | Return true if the object is a boolean value. |
false | Return true if the object is False. |
true | Return true if the object is True. |
integer | Return true if the object is an integer. |
float | Return true if the object is a float. |
lower | Return true if the variable is lowercased. |
upper | Return true if the variable is uppercased. |
string | Return true if the object is a string. |
mapping | Return true if the object is a mapping (dict etc.). |
number | Return true if the variable is a number. |
sequence | Return true if the variable is a sequence. Sequences are variables |
iterable | Check if it's possible to iterate over an object. |
callable | Return whether the object is callable (i.e., some kind of function). |
sameas | Check if an object points to the same memory address than another |
escaped | Check if the value is escaped. |
in | Check if value is in seq. |
eq | Same as a == b. |
ne | Same as a != b. |
gt | Same as a > b. |
ge | Same as a >= b. |
lt | Same as a < b. |
le | Same as a <= b. |
environment¶
Name | Description |
---|---|
template | Check whether given template path exists. |
file¶
Name | Description |
---|---|
folder_with_files | Check if given directory exists and contains any files. |
file | Test whether a path is a regular file |
dir | Return true if the pathname refers to an existing directory. |
inspect¶
Name | Description |
---|---|
abstract | Return true if the object is an abstract base class (ABC). |
routine | Return true if the object is any kind of function or method. |
module | Return true if the object is a module. |
class | Return true if the object is a class. |
method | Return true if the object is an instance method. |
function | Return true if the object is a user-defined function. |
generatorfunction | Return true if the object is a user-defined generator function. |
generator | Return true if the object is a generator. |
coroutinefunction | Return true if the object is a coroutine function. |
coroutine | Return true if the object is a coroutine. |
awaitable | Return true if object can be passed to an await expression. |
asyncgenfunction | Return true if the object is an asynchronous generator function. |
asyncgen | Return true if the object is an asynchronous generator. |
traceback | Return true if the object is a traceback. |
frame | Return true if the object is a frame object. |
code | Return true if the object is a code object. |
methodwrapper | Return true if the object is a method wrapper. |
methoddescriptor | Return true if the object is a method descriptor. |
datadescriptor | Return true if the object is a data descriptor. |
getsetdescriptor | Return true if the object is a getset descriptor. |
memberdescriptor | Return true if the object is a member descriptor. |
python¶
Name | Description |
---|---|
python_keyword | Return true when given string represents a python keyword. |
python_builtin | Return true when given fn / string represents a python builtin. |
in_std_library | Return true when given fn / string is part of the std library. |
system¶
Name | Description |
---|---|
installed | Returns true if a package with given name is found. |
env_var | Returns true if an environment variable with given name has a value. |
text¶
Name | Description |
---|---|
indented | Check whether all lines of given text are indented. |
type¶
Name | Description |
---|---|
number | Try to convert value to a float. |
list | Return whether a value is a list. |
set | Return whether a value is a set. |
tuple | Return whether a value is a tuple. |
dict | Return whether a value is a tuple. |
type | Return whether a value is a type. |
datetime | Return whether a value is a datetime. |
string_like | Return whether a value is a string or string like object. |
subclass | Like the issubclass builtin, but also accepts strs as type. |
instance | Like the isinstance builtin, but also accepts strs as type. |
url¶
Name | Description |
---|---|
http_url | Return true when given string represents a HTTP url. |
fsspec_url | Returns true if the given URL looks like an fsspec protocol, except http/https. |
url | Return true when given string represents any type of URL. |