unable to get different dates with FuzzyDateTime
See original GitHub issueHello, In Django tests, i have
class EventFactory(factory.django.DjangoModelFactory):
...
dtstart = FuzzyDateTime(datetime.datetime(2008, 1, 1, tzinfo=UTC), datetime.datetime(2009, 1, 1, tzinfo=UTC),
force_hour=10,
force_minute=30,
force_second=0, force_microsecond=0).evaluate(2, None, False)
and i use it:
self.event = EventFactory.create()
self.event2 = EventFactory.create()
self.event3 = EventFactory.create()
Displaying the resulting dtstart, i got: dtstart: “2008-07-21 10:30:00+00:00” dtstart: “2008-07-21 10:30:00+00:00” dtstart: “2008-07-21 10:30:00+00:00” The dates are the same, that’s not what i expect.
What i don’t understand is when i try it in python shell, everytime i call FuzzyDateTime(…), the rresult is always different.
Am i missing something?
thanks in advance for help,
gerard
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Factory-boy fuzzy DateTimeField always the same date when ...
I am using factory-boy for creating instances of a Django model, and I am always getting the same value returned when using factory.fuzzy....
Read more >Complete documentation for the fuzzy date/time parser
It tries to match common formats, but there are a ton of ways to write dates out, so it can't always get it...
Read more >How do you store "fuzzy dates" into a database?
Store all dates in normal DATE field in the database and have additional accuracy field how accurate DATE field actually is.
Read more >Fuzzy attributes — Factory Boy stable documentation
It is expected that successive calls of that function return various values. ... The FuzzyDate fuzzer generates random dates within a given inclusive...
Read more >Fuzzy Datetime Compare - Forums - SQLServerCentral
The problem: I have two data sources, Google Analytics and our own internal Application Form. Each source records the exact same goal/event, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
To get a
end_dt
, simply do the following:As to the sequence, this is easy to design by overriding the rule for
start_dt
when callingcreate_batch
:Hi,
I’m closing this issue for now; feel free to re-open it if you need more help on this topic!