-
Notifications
You must be signed in to change notification settings - Fork 13
Closed
Labels
Description
Here are our docs for now:
selfie/selfie.dev/src/pages/py/get-started.mdx
Lines 38 to 48 in 7b31cc6
| Let's say we have the following test code: | |
| ```python | |
| expectSelfie(str([1, 2, 3])).toBe_TODO() | |
| ``` | |
| If you run this test, selfie will rewrite your sourcecode to be this: | |
| ```python | |
| expectSelfie(str([1, 2, 3])).toBe("[1, 2, 3]") | |
| ``` |
Inside of expectSelfie, we can switch on the object type to return primitives, for example
selfie/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/SelfieImplementations.kt
Lines 288 to 293 in 7b31cc6
| class IntSelfie(private val actual: Int) { | |
| @JvmOverloads fun toBe_TODO(unusedArg: Any? = null) = toBeDidntMatch(null, actual, LiteralInt) | |
| fun toBe(expected: Int) = | |
| if (actual == expected) Selfie.system.checkSrc(actual) | |
| else toBeDidntMatch(expected, actual, LiteralInt) | |
| } |
But for other things like an array or FooPerson, we have some design choices to make. We should probably call either __str__ or __repr__ on the object. I'm leaning towards __repr__.
https://chat.openai.com/share/b438ed63-4796-4418-89e1-eb055042e786
TBD!