Selfie
Loading...
Searching...
No Matches
selfie_lib.SelfieImplementations.StringSelfie Class Reference
Inheritance diagram for selfie_lib.SelfieImplementations.StringSelfie:
selfie_lib.SelfieImplementations.ReprSelfie selfie_lib.SelfieImplementations.StringFacet selfie_lib.SelfieImplementations.DiskSelfie selfie_lib.SelfieImplementations.FluentFacet selfie_lib.SelfieImplementations.FluentFacet

Public Member Functions

 __init__ (self, Snapshot actual, DiskStorage disk, Optional[list[str]] only_facets=None)
"StringSelfie" to_match_disk (self, str sub="")
"StringSelfie" to_match_disk_TODO (self, str sub="")
str to_be_TODO (self, Any _=None)
str to_be (self, str expected)
Public Member Functions inherited from selfie_lib.SelfieImplementations.ReprSelfie
 __init__ (self, T actual_before_repr, Snapshot actual, DiskStorage disk)
Public Member Functions inherited from selfie_lib.SelfieImplementations.DiskSelfie
 __init__ (self, Snapshot actual, DiskStorage disk)
"StringFacet" facet (self, str facet)
"StringFacet" facets (self, *str facets)
"BinaryFacet" facet_binary (self, str facet)

Public Attributes

 only_facets = only_facets
Public Attributes inherited from selfie_lib.SelfieImplementations.ReprSelfie
 actual_before_repr = actual_before_repr
Public Attributes inherited from selfie_lib.SelfieImplementations.DiskSelfie
 actual = actual
 disk = disk

Detailed Description

Definition at line 112 of file SelfieImplementations.py.

Constructor & Destructor Documentation

◆ __init__()

selfie_lib.SelfieImplementations.StringSelfie.__init__ ( self,
Snapshot actual,
DiskStorage disk,
Optional[list[str]] only_facets = None )

Definition at line 113 of file SelfieImplementations.py.

118 ):
119 super().__init__("<IT IS AN ERROR FOR THIS TO BE VISIBLE>", actual, disk)
120 self.only_facets = only_facets
121
122 if self.only_facets is not None:
123 assert all(
124 facet == "" or facet in actual.facets for facet in self.only_facets
125 ), f"The following facets were not found in the snapshot: {[facet for facet in self.only_facets if actual.subject_or_facet_maybe(facet) is None]}\navailable facets are: {list(actual.facets.keys())}"
126 assert (
127 len(self.only_facets) > 0
128 ), "Must have at least one facet to display, this was empty."
129 if "" in self.only_facets:
130 assert (
131 self.only_facets.index("") == 0
132 ), f'If you\'re going to specify the subject facet (""), you have to list it first, this was {self.only_facets}'
133

Member Function Documentation

◆ to_be()

str selfie_lib.SelfieImplementations.StringSelfie.to_be ( self,
str expected )

Reimplemented from selfie_lib.SelfieImplementations.ReprSelfie.

Definition at line 164 of file SelfieImplementations.py.

164 def to_be(self, expected: str) -> str:
165 actual_string = self.__actual()
166 if actual_string == expected:
167 return _check_src(actual_string)
168 else:
169 return _to_be_didnt_match(
170 expected,
171 actual_string,
172 LiteralString(),
173 )
174
175

◆ to_be_TODO()

str selfie_lib.SelfieImplementations.StringSelfie.to_be_TODO ( self,
Any _ = None )

Reimplemented from selfie_lib.SelfieImplementations.ReprSelfie.

Definition at line 161 of file SelfieImplementations.py.

161 def to_be_TODO(self, _: Any = None) -> str:
162 return _to_be_didnt_match(None, self.__actual(), LiteralString())
163

◆ to_match_disk()

"StringSelfie" selfie_lib.SelfieImplementations.StringSelfie.to_match_disk ( self,
str sub = "" )

Reimplemented from selfie_lib.SelfieImplementations.DiskSelfie.

Definition at line 134 of file SelfieImplementations.py.

134 def to_match_disk(self, sub: str = "") -> "StringSelfie":
135 super().to_match_disk(sub)
136 return self
137

◆ to_match_disk_TODO()

"StringSelfie" selfie_lib.SelfieImplementations.StringSelfie.to_match_disk_TODO ( self,
str sub = "" )

Reimplemented from selfie_lib.SelfieImplementations.DiskSelfie.

Definition at line 138 of file SelfieImplementations.py.

138 def to_match_disk_TODO(self, sub: str = "") -> "StringSelfie":
139 super().to_match_disk_TODO(sub)
140 return self
141

Member Data Documentation

◆ only_facets

selfie_lib.SelfieImplementations.StringSelfie.only_facets = only_facets

Definition at line 120 of file SelfieImplementations.py.


The documentation for this class was generated from the following file: