I’m trying to make an assertion that an item has recieved yet another timestamp in a list. My current solution is to do a regular match which will fail the test if not working. I obviously find out if my test does not work but it feels rather hacky and not a proper solution.
This timestamp is what? A NaiveDateTime? A DateTime? A Date? A String? And you’re asserting strict equality, not only matching! Please, give a example structure
I see. It was obviously much clearer in my head than for outsiders. They happen to be strings.
I also see that I could skip a lot of things and just give this question instead:
Given that I have a function random_string() that returns a random string of some sort. the variable list will in actual be constructed in some function that I want to test.
This assertion works if I know the exact outcome
list = ["two", "strings"]
assert ["two", "strings"] == list
but I cannot do this
list = [random_string(), random_string()]
assert [is_bitstring(x), is_bitstring(y)] == list
I can of cause do this
list = [random_string(), random_string()]
[a, b] = list
assert is_bitstring(a)
assert is_bitstring(b)
but it feels a bit clumsy
Simply summarized, can I assert the type of the items in the list without first match them out?