Esempio n. 1
0
    def simplify_such_that(self, t, f):
        tracker = Tracker()

        while True:
            for s in self.simplify(t):
                if tracker.track(s) > 1: 
                    continue
                if f(s):
                    t = s
                    break
            else:
                return t  
Esempio n. 2
0
    def simplify_such_that(self, t, f):
        tracker = Tracker()

        while True:
            for s in self.simplify(t):
                if tracker.track(s) > 1:
                    continue
                if f(s):
                    t = s
                    break
            else:
                return t
Esempio n. 3
0
def test_track_lists():
    t = Tracker()
    assert t.track([1]) == 1
    assert t.track([1]) == 2
Esempio n. 4
0
def test_track_ints():
    t = Tracker()
    assert t.track(1) == 1
    assert t.track(1) == 2
Esempio n. 5
0
def test_nested_unhashables():
    t = Tracker()
    x = {"foo": [1, 2, {3, 4, 5, 6}], "bar": 10}
    assert t.track(x) == 1
    assert t.track(x) == 2
Esempio n. 6
0
def assert_no_duplicates_in_simplify(s, x):
    s = strategy(s)
    t = Tracker()
    t.track(x)
    for y in s.simplify(x):
        assert t.track(y) == 1
Esempio n. 7
0
def assert_no_duplicates_in_simplify(s, x):
    s = strategy(s)
    t = Tracker()
    t.track(x)
    for y in s.simplify(x):
        assert t.track(y) == 1
Esempio n. 8
0
def test_track_lists():
    t = Tracker()
    assert t.track([1]) == 1
    assert t.track([1]) == 2
Esempio n. 9
0
def test_track_ints():
    t = Tracker()
    assert t.track(1) == 1
    assert t.track(1) == 2
Esempio n. 10
0
def test_nested_unhashables():
    t = Tracker()
    x = {"foo" : [1,2,{3,4,5,6}], "bar" : 10}
    assert t.track(x) == 1
    assert t.track(x) == 2