envtests
Class info¶
🛈 DocStrings¶
contains_files
¶
Check if given directory exists and contains any files.
Supports regular file paths and fsspec URLs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
directory
|
str | PathLike[str]
|
The directoy to check |
required |
Source code in src/jinjarope/envtests.py
168 169 170 171 172 173 174 175 176 177 |
|
is_env_var
¶
Returns true if an environment variable with given name has a value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env_var
|
str
|
The environment variable name to check |
required |
Source code in src/jinjarope/envtests.py
191 192 193 194 195 196 197 |
|
is_fsspec_url
¶
Returns true if the given URL looks like an fsspec protocol, except http/https.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str | PathLike[str]
|
The URL to check |
required |
Source code in src/jinjarope/envtests.py
155 156 157 158 159 160 161 162 163 164 165 |
|
is_http_url
¶
Return true when given string represents a HTTP url.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to check |
required |
Source code in src/jinjarope/envtests.py
107 108 109 110 111 112 113 |
|
is_in_std_library
¶
Return true when given fn / string is part of the std library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn
|
str | Callable[..., Any]
|
(Name of) function to check |
required |
Source code in src/jinjarope/envtests.py
145 146 147 148 149 150 151 152 |
|
is_indented
¶
Check whether all lines of given text are indented.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
The text to check |
required |
indentation
|
str
|
The indent each line must start with |
' '
|
Source code in src/jinjarope/envtests.py
200 201 202 203 204 205 206 207 |
|
is_installed
¶
Returns true if a package with given name is found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
package_name
|
str
|
The package name to check |
required |
Source code in src/jinjarope/envtests.py
180 181 182 183 184 185 186 187 188 |
|
is_instance
¶
Like the isinstance builtin, but also accepts strs as type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
object
|
The object to check |
required |
typ
|
str | type
|
A type (name) |
required |
Source code in src/jinjarope/envtests.py
71 72 73 74 75 76 77 78 79 80 81 |
|
is_number
¶
Try to convert value to a float.
Source code in src/jinjarope/envtests.py
27 28 29 30 31 32 33 |
|
is_protocol_url
¶
Return true when given string represents any type of URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to check |
required |
Source code in src/jinjarope/envtests.py
116 117 118 119 120 121 122 |
|
is_python_builtin
¶
Return true when given fn / string represents a python builtin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn
|
str | Callable[..., Any]
|
(Name of) function to check |
required |
Source code in src/jinjarope/envtests.py
136 137 138 139 140 141 142 |
|
is_python_keyword
¶
Return true when given string represents a python keyword.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to check |
required |
Source code in src/jinjarope/envtests.py
125 126 127 128 129 130 131 132 133 |
|
is_subclass
¶
Like the issubclass builtin, but also accepts strs as type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj
|
type
|
The class to check |
required |
typ
|
str | type
|
A type (name) |
required |
Source code in src/jinjarope/envtests.py
84 85 86 87 88 89 90 91 92 93 94 |
|