ActionSubject¶
ActionSubject.new¶
ActionSubject.new(action, meta)
Creates an “ActionSubject” struct.
Method: ActionSubject.new
Example usage:
expect(env).that_action(action).not_contains_arg("foo")
PARAMETERS ¶
- action¶:
(
Action
) value to check against.- meta¶:
(
ExpectMeta
) of call chain information.
- RETURNS ¶
ActionSubject
object.
ActionSubject.parse_flags¶
ActionSubject.parse_flags(argv)
PARAMETERS ¶
- argv¶:
undocumented
ActionSubject.argv¶
ActionSubject.argv()
Returns a CollectionSubject for the action’s argv.
Method: ActionSubject.argv
- RETURNS ¶
CollectionSubject
object.
ActionSubject.contains_at_least_args¶
ActionSubject.contains_at_least_args(args)
Assert that an action contains at least the provided args.
Method: ActionSubject.contains_at_least_args
Example usage: expect(env).that_action(action).contains_at_least_args([“foo”, “bar”]).
PARAMETERS ¶
ActionSubject.not_contains_arg¶
ActionSubject.not_contains_arg(arg)
Assert that an action does not contain an arg.
Example usage: expect(env).that_action(action).not_contains_arg(“should-not-exist”)
PARAMETERS ¶
ActionSubject.substitutions¶
ActionSubject.substitutions()
Creates a DictSubject
to assert on the substitutions dict.
Method: ActionSubject.substitutions.
- RETURNS ¶
DictSubject
struct.
ActionSubject.has_flags_specified¶
ActionSubject.has_flags_specified(flags)
Assert that an action has the given flags present (but ignore any value).
Method: ActionSubject.has_flags_specified
This parses the argv, assuming the typical formats (--flag=value
,
--flag value
, and --flag
). Any of the formats will be matched.
Example usage, given argv = ["--a", "--b=1", "--c", "2"]
:
expect(env).that_action(action).has_flags_specified([
“–a”, “–b”, “–c”])
PARAMETERS ¶
ActionSubject.mnemonic¶
ActionSubject.mnemonic()
Returns a StrSubject
for the action’s mnemonic.
Method: ActionSubject.mnemonic
- RETURNS ¶
StrSubject
object.
ActionSubject.inputs¶
ActionSubject.inputs()
Returns a DepsetFileSubject for the action’s inputs.
Method: ActionSubject.inputs
- RETURNS ¶
DepsetFileSubject
of the action’s inputs.
ActionSubject.contains_flag_values¶
ActionSubject.contains_flag_values(flag_values)
Assert that an action’s argv has the given (”–flag”, “value”) entries.
Method: ActionSubject.contains_flag_values
This parses the argv, assuming the typical formats (--flag=value
,
--flag value
, and --flag
). Note, however, that for the --flag value
and --flag
forms, the parsing can’t know how many args, if any, a flag
actually consumes, so it simply takes the first following arg, if any, as
the matching value.
NOTE: This function can give misleading results checking flags that don’t
consume any args (e.g. boolean flags). Use has_flags_specified()
to test
for such flags. Such cases will either show the subsequent arg as the value,
or None if the flag was the last arg in argv.
Example usage, given argv = ["--b=1", "--c", "2"]
:
expect(env).that_action(action).contains_flag_values([
(”–b”, “1”),
(”–c”, “2”)
])
PARAMETERS ¶
ActionSubject.contains_none_of_flag_values¶
ActionSubject.contains_none_of_flag_values(flag_values)
Assert that an action’s argv has none of the given (”–flag”, “value”) entries.
Method: ActionSubject.contains_none_of_flag_values
This parses the argv, assuming the typical formats (--flag=value
,
--flag value
, and --flag
). Note, however, that for the --flag value
and --flag
forms, the parsing can’t know how many args, if any, a flag
actually consumes, so it simply takes the first following arg, if any, as
the matching value.
NOTE: This function can give misleading results checking flags that don’t
consume any args (e.g. boolean flags). Use has_flags_specified()
to test
for such flags.
PARAMETERS ¶
ActionSubject.contains_at_least_inputs¶
ActionSubject.contains_at_least_inputs(inputs)
Assert the action’s inputs contains at least all of inputs
.
Method: ActionSubject.contains_at_least_inputs
Example usage:
expect(env).that_action(action).contains_at_least_inputs([
PARAMETERS ¶
ActionSubject.content¶
ActionSubject.content()
Returns a StrSubject
for Action.content
.
Method: ActionSubject.content
- RETURNS ¶
StrSubject
object.
ActionSubject.env¶
ActionSubject.env()
Returns a DictSubject
for Action.env
.
Method: ActionSubject.env