Ejemplo n.º 1
0
def test_papers():
    paper_tree = PaperTree('CS1', [], all_papers=True, by_year=False)
    assert paper_tree._name == 'CS1'
    print(paper_tree._subtrees)
    assert paper_tree._subtrees[0]._name == 'FLP'
    assert paper_tree._subtrees[0]._subtrees[0]._name == 'other'
    assert paper_tree._subtrees[0]._subtrees[0]._subtrees[0]._name \
           ==  'language agnostic approaches'
    assert paper_tree._subtrees[0]._subtrees[0]._subtrees[0]._subtrees[0]._name\
           == 'Separation of Introductory Programming and Language Instruction'
    assert paper_tree._subtrees[0]._subtrees[0]._subtrees[0]._subtrees[
        0]._subtrees == []
    assert len(paper_tree._subtrees[0]._subtrees) == 4
    assert paper_tree._count_leaves() == 483
    assert paper_tree._subtrees[2]._name == 'Students'
    l = len(paper_tree._subtrees[2]._subtrees)
    assert paper_tree._subtrees[2]._subtrees[l - 1]._name == 'prior knowledge'
    assert len(paper_tree._subtrees[2]._subtrees[l - 1]._subtrees) == 6
    for i in range(5):
        assert len(
            paper_tree._subtrees[2]._subtrees[l -
                                              1]._subtrees[i]._subtrees) == 0
    assert paper_tree._subtrees[2]._subtrees[l - 1]._subtrees[4].data_size == 0
    assert len(
        paper_tree._subtrees[2]._subtrees[l - 1]._subtrees[5]._subtrees) != 0
def run_treemap_papers() -> None:
    """Run a treemap visualization for CS Education research papers data.

    You can try changing the value of the named argument by_year, but the
    others should stay the same.
    """
    paper_tree = PaperTree('CS1', [], all_papers=True, by_year=False)
    run_visualisation(paper_tree)
Ejemplo n.º 3
0
def run_treemap_papers() -> None:
    """Runs a treemap visualization for CS Education research papers data."""

    paper_tree = PaperTree('CS1', [], all_papers=True, by_year=False)
    run_visualisation(paper_tree)
Ejemplo n.º 4
0
def test_papers_tree_categories() -> None:
    tree = PaperTree('CS1', [], all_papers=True, by_year=False)
    assert len(tree._subtrees) == 9
    assert tree.data_size == 5048
Ejemplo n.º 5
0
def test_empty_papers_tree() -> None:
    tree = PaperTree(None, [], citations=0)
    assert tree._name is None
    assert tree._subtrees == []
Ejemplo n.º 6
0
import os
import math
from tm_trees import FileSystemTree
from papers import PaperTree

s = PaperTree('CS1', [], all_papers=True)
s.update_rectangles((0, 0, 1800, 900))
# print(s._subtrees[1]._subtrees[2].data_size)
r = FileSystemTree('example-directory')
r.update_rectangles((0, 0, 1800, 900))
s.expand_all()
r.expand_all()
print(r.get_rectangles())
print('' '' '' '' '' '')
print(len(s.get_rectangles()))