
from __future__ import unicode_literals

from common import FieldExam
from marrow.mongo.field import Date


class TestDateField(FieldExam):
	__field__ = Date


from __future__ import unicode_literals

from datetime import datetime

from bson import ObjectId
from common import FieldExam
from marrow.mongo.field import Date


class TestDateField(FieldExam):
	__field__ = Date
	
	def test_date_like_oid(self, Sample):
		oid = ObjectId('586846800000000000000000')
		
		assert Sample(oid).field.replace(tzinfo=None) == datetime(2017, 1, 1)

Add test for extraction of dates from ObjectIds.
Add test for extraction of dates from ObjectIds.

  
  from __future__ import unicode_literals
  
+ from datetime import datetime
+ 
+ from bson import ObjectId
  from common import FieldExam
  from marrow.mongo.field import Date
  
  
  class TestDateField(FieldExam):
  	__field__ = Date
+ 	
+ 	def test_date_like_oid(self, Sample):
+ 		oid = ObjectId('586846800000000000000000')
+ 		
+ 		assert Sample(oid).field.replace(tzinfo=None) == datetime(2017, 1, 1)
  
Add test for extraction of dates from ObjectIds.
## Code Before:

from __future__ import unicode_literals

from common import FieldExam
from marrow.mongo.field import Date


class TestDateField(FieldExam):
	__field__ = Date

## Instruction:
Add test for extraction of dates from ObjectIds.
## Code After:

from __future__ import unicode_literals

from datetime import datetime

from bson import ObjectId
from common import FieldExam
from marrow.mongo.field import Date


class TestDateField(FieldExam):
	__field__ = Date
	
	def test_date_like_oid(self, Sample):
		oid = ObjectId('586846800000000000000000')
		
		assert Sample(oid).field.replace(tzinfo=None) == datetime(2017, 1, 1)
