コード例 #1
0
ファイル: test.py プロジェクト: shouldsee/file_tracer
    def test_tamp(self):
        # with self.DIR:
        tracer = FileTracer()
        v = InputFile('input1.html')
        v.addTimeStamp()

        time.sleep(0.02)
        vout = InputFile(v)
        vout.addTimeStamp()
        assert (v.stamp == vout.stamp), (v.stamp, vout.stamp)

        time.sleep(0.02)
        with open(v, 'w') as f:
            f.write('test111111111')
        vout = type(v)(v)
        vout.addTimeStamp()
        assert (v.stamp != vout.stamp), (v.stamp, vout.stamp)
コード例 #2
0
from file_tracer import FileTracer, InputFile, OutputFile, tree_as_string
from collections import Counter

tracer = FileTracer()

import time
import dill

v = InputFile('input1.html')
v.addTimeStamp()
s = dill.dumps(v)
time.sleep(0.02)
vout = dill.loads(s)
vout.addTimeStamp()
assert (v.stamp == vout.stamp), (v.stamp, vout.stamp)

time.sleep(0.02)
with open(v, 'w') as f:
    f.write('test111111111')
vout = type(v)(v)
vout.addTimeStamp()
assert (v.stamp != vout.stamp), (v.stamp, vout.stamp)
print v.stamp
print vout.stamp
# stat_result.st_mtime
print(hash(v))
v.addTimeStamp()
print(hash(v))
print(hash(vout))
print(v == vout)