diff --git a/flow/record/fieldtypes/__init__.py b/flow/record/fieldtypes/__init__.py index 0160a86..ca7d0af 100644 --- a/flow/record/fieldtypes/__init__.py +++ b/flow/record/fieldtypes/__init__.py @@ -283,6 +283,9 @@ def __repr__(self): result = str(self) return result + def __hash__(self): + return _dt.__hash__(self) + class varint(varint_type, FieldType): def _pack(self): diff --git a/tests/test_fieldtypes.py b/tests/test_fieldtypes.py index a841ed6..f1500b6 100644 --- a/tests/test_fieldtypes.py +++ b/tests/test_fieldtypes.py @@ -422,6 +422,10 @@ def test_datetime(): r = TestRecord(1521731723.123456) assert r.ts == datetime.datetime(2018, 3, 22, 15, 15, 23, 123456) + r = TestRecord("2018-03-22T15:15:23.123456") + test = {r.ts: "Success"} + assert test[r.ts] == "Success" + @pytest.mark.parametrize( "value,expected_dt",