Skip to content

Commit

Permalink
Test timestamp autoupdate for Tag properties
Browse files Browse the repository at this point in the history
  • Loading branch information
achilleas-k committed Apr 30, 2020
1 parent 2798d74 commit 2fc194e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions nixio/test/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# modification, are permitted under the terms of the BSD License. See
# LICENSE file in the root of the Project.
import os
import time
import unittest
import numpy as np
import nixio as nix
Expand Down Expand Up @@ -297,3 +298,40 @@ def test_tag_feature_data(self):

assert (data1.size == 1)
assert (data2.size == 3)

def test_timestamp_autoupdate(self):
tag = self.block.create_tag("tag.time", "test.time", [-1])

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.position = [-100]
self.assertNotEqual(tag.updated_at, tagtime)

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.extent = [30]
self.assertNotEqual(tag.updated_at, tagtime)

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.units = "Mm"
self.assertNotEqual(tag.updated_at, tagtime)

def test_timestamp_noautoupdate(self):
self.file.auto_update_timestamps = False
tag = self.block.create_tag("tag.time", "test.time", [-1])

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.position = [-100]
self.assertEqual(tag.updated_at, tagtime)

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.extent = [30]
self.assertEqual(tag.updated_at, tagtime)

tagtime = tag.updated_at
time.sleep(1) # wait for time to change
tag.units = "Mm"
self.assertEqual(tag.updated_at, tagtime)

0 comments on commit 2fc194e

Please sign in to comment.