# FileSubject {.starlark-object} ## FileSubject.basename {.starlark-signature} FileSubject.basename() Returns a `StrSubject` asserting on the files `basename` value. Method: FileSubject.basename {#filesubject_basename_returns} RETURNS [¶](#filesubject_basename_returns){.headerlink} : [`StrSubject`] object. {.starlark-object} ## FileSubject.equals {.starlark-signature} FileSubject.equals([expected](#filesubject_equals_expected)) Asserts that `expected` references the same file as `self`. This uses Bazel's notion of [`File`] equality, which usually includes the configuration, owning action, internal hash, etc of a `File`. The particulars of comparison depend on the actual Java type implementing the `File` object (some ignore owner, for example). NOTE: This does not compare file content. Starlark cannot read files. NOTE: Same files generated by different owners are likely considered not equal to each other. The alternative for this is to assert the `File.path` paths are equal using [`FileSubject.path()`] Method: FileSubject.equals {#filesubject_equals_parameters} **PARAMETERS** [¶](#filesubject_equals_parameters){.headerlink} :[expected[¶](#filesubject_equals_expected){.headerlink}]{.span}: []{#filesubject_equals_expected} _undocumented_ {.starlark-object} ## FileSubject.new {.starlark-signature} FileSubject.new([file](#filesubject_new_file), [meta](#filesubject_new_meta)) Creates a FileSubject asserting against the given file. Method: FileSubject.new {#filesubject_new_parameters} **PARAMETERS** [¶](#filesubject_new_parameters){.headerlink} {.params-box} :[file[¶](#filesubject_new_file){.headerlink}]{.span}: []{#filesubject_new_file} ([`File`]) the file to assert against. :[meta[¶](#filesubject_new_meta){.headerlink}]{.span}: []{#filesubject_new_meta} ([`ExpectMeta`]) {#filesubject_new_returns} RETURNS [¶](#filesubject_new_returns){.headerlink} : [`FileSubject`] object. {.starlark-object} ## FileSubject.path {.starlark-signature} FileSubject.path() Returns a `StrSubject` asserting on the files `path` value. Method: FileSubject.path {#filesubject_path_returns} RETURNS [¶](#filesubject_path_returns){.headerlink} : [`StrSubject`] object. {.starlark-object} ## FileSubject.short_path_equals {.starlark-signature} FileSubject.short_path_equals([path](#filesubject_short_path_equals_path)) Asserts the file's short path is equal to the given path. Method: FileSubject.short_path_equals {#filesubject_short_path_equals_parameters} **PARAMETERS** [¶](#filesubject_short_path_equals_parameters){.headerlink} :[path[¶](#filesubject_short_path_equals_path){.headerlink}]{.span}: []{#filesubject_short_path_equals_path} ([`str`]) the value the file's `short_path` must be equal to. [`Action`]: https://bazel.build/rules/lib/Action [`ActionSubject`]: /api/action_subject [`bool`]: https://bazel.build/rules/lib/bool [`BoolSubject`]: /api/bool_subject [`CollectionSubject`]: /api/collection_subject [`depset`]: https://bazel.build/rules/lib/depset [`DepsetFileSubject`]: /api/depset_file_subject [`dict`]: https://bazel.build/rules/lib/dict [`DictSubject`]: /api/dict_subject [`Expect`]: /api/expect [`ExpectMeta`]: /api/expect_meta [`File`]: https://bazel.build/rules/lib/File [`FileSubject`]: /api/file_subject [`format_str`]: /api/expect_meta.html#expectmeta-format-str [`IntSubject`]: /api/int_subject [`Label`]: https://bazel.build/rules/lib/Label [`LabelSubject`]: /api/label_subject [`list`]: https://bazel.build/rules/lib/list [`Ordered`]: /api/ordered [`RunfilesSubject`]: /api/runfiles_subject [`str`]: https://bazel.build/rules/lib/string [`struct`]: https://bazel.build/rules/lib/builtins/struct [`StrSubject`]: /api/str_subject [`StructSubject`]: /api/struct_subject [`Target`]: https://bazel.build/rules/lib/Target [`TargetSubject`]: /api/target_subject [target-name]: https://bazel.build/concepts/labels#target-names [attr-label]: https://bazel.build/concepts/labels