Exemplo n.º 1
0
    def test_reverse_bug(self):
        store = Storage(filename=self.filename, mode='w')
        assert (os.path.isfile(self.filename))

        store.snapshots.save(self.template_snapshot)
        rev = self.template_snapshot.reversed

        # save the reversed one
        store.snapshots.save(rev)

        # check that the reversed one has index 1 and not 3!
        assert (store.idx(rev) == 1)

        # and we have exactly one snapshot
        assert (len(store.snapshots) == 2)
        assert (len(store.dimensions['snapshots']) == 1)
        store.close()
Exemplo n.º 2
0
    def test_reverse_bug(self):
        store = Storage(filename=self.filename,
                        mode='w', use_uuid=False)
        assert(os.path.isfile(self.filename))

        store.snapshots.save(self.template_snapshot)
        rev = self.template_snapshot.reversed

        # save the reversed one
        store.snapshots.save(rev)

        # check that the reversed one has index 1 and not 3!
        assert(store.idx(rev) == 1)

        # and we have exactly one snapshot
        assert(len(store.snapshots) == 2)
        assert(len(store.dimensions['snapshots']) == 1)
        store.close()
Exemplo n.º 3
0
#            add = '{ %d : %f, ... } ' % (found_values[0][0], found_values[0][1]._value )

#        nline(p_idx,obj.name, str(len(found_values)) + ' entries ' + add)

    headline("MCSteps")

    for p_idx in range(0, storage.steps.count()):
        obj = storage.steps.load(p_idx)
        nline(p_idx, '', '')
        print indent(str(obj.change),16)

    headline("SampleSets")

    for p_idx in range(0, storage.samplesets.count()):
        obj = storage.samplesets.load(p_idx)
        nline(p_idx, str(len(obj)) + ' sample(s)', [storage.idx(sample) for sample in obj ])
        print indent(str(obj.movepath),16)


    headline("Samples")

    def shortened_dict(d):
        keys = sorted(d.keys())
        old_idx = -2
        count = 0
        for idx in keys:
            if idx == old_idx + 1 or idx == old_idx - 1:
                count += 1
            else:
                if count > 1:
                    sys.stdout.write(" <" + str(count - 1) + ">")