コード例 #1
0
    def test_gets_leaves_and_filterbyname(self):
        tmf = models.TreeModelFactory('tests/fixtures/filterbyname')
        tree = tmf.getInstance()

        result = tree.filterBy("name", "ciccio").getLeaves()
        print(result)
        assert result == [{"prop": "value4"}, {"prop": "value5"}]
コード例 #2
0
    def test_gets_leaves_on_oneleveltree(self):
        tmf = models.TreeModelFactory('tests/fixtures/oneleveltree')
        tree = tmf.getInstance()

        result = tree.getLeaves()

        assert result == [{"prop": "value1"}, {"prop": "value2"}]
コード例 #3
0
    def test_gets_leaf_on_zerolevel(self):

        tmf = models.TreeModelFactory('tests/fixtures/zerolevelthree')
        tree = tmf.getInstance()

        result = tree.getLeaves()

        assert result == [{'prop': "value"}]
コード例 #4
0
    def txest_gets_leaves_on_threeleveletc(self):
        tmf = models.TreeModelFactory('tests/fixtures/threelevelbalancedfigli')
        tree = tmf.getInstance()

        result = tree.navigateBy("figli").getLeaves()
        assert result == [{
            "prop": "value4"
        }, {
            "prop": "value5"
        }, {
            "prop": "value6"
        }]
コード例 #5
0
 def __init__(self, dataSource, navigateKey, filterKey):
     self.__treeModel = models.TreeModelFactory(dataSource).getInstance()
     self.__navigateKey = navigateKey
     self.__filterKey = filterKey
コード例 #6
0
    def test_creates_a_treeModel(self):

        tmf = models.TreeModelFactory('tests/fixtures/some')
        treeModel = tmf.getInstance()

        assert treeModel is not None
コード例 #7
0
    def test_gets_leaves_on_twolevelunbalanced(self):
        tmf = models.TreeModelFactory('tests/fixtures/twolevelunbalanced')
        tree = tmf.getInstance()

        result = tree.getLeaves()
        assert result == [{"prop": "value1"}, {"prop": "value3"}]