예제 #1
0
def test_explore_from_json():
    model_name = "eye_exam"
    json_dict = load_resource("response_models.json")
    explore = Explore.from_json(json_dict[0]["explores"][0], model_name)
    assert explore.name == "test_explore_one"
    assert explore.model_name == model_name
    assert explore.dimensions == []
def test_article_example():
    """Source: http://www.prevko.cz/dite/skutecne-pribehy-deti"""
    parser = PlaintextParser.from_string(
        load_resource("articles/prevko_cz_1.txt"),
        Tokenizer("czech")
    )
    summarizer = LexRankSummarizer(stem_word)
    summarizer.stop_words = get_stop_words("czech")

    sentences = summarizer(parser.document, 20)
    assert len(sentences) == 20
def test_real_example():
    """Source: http://www.prevko.cz/dite/skutecne-pribehy-deti"""
    parser = PlaintextParser.from_string(
        load_resource("snippets/prevko.txt"),
        Tokenizer("czech")
    )
    summarizer = LsaSummarizer(Stemmer("czech"))
    summarizer.stop_words = get_stop_words("czech")

    sentences = summarizer(parser.document, 2)
    assert len(sentences) == 2
예제 #4
0
def test_dimension_from_json():
    model_name = "eye_exam"
    explore_name = "users"
    json_dict = load_resource("response_dimensions.json")
    dimension = Dimension.from_json(json_dict[0], model_name, explore_name)
    assert dimension.name == "test_view.dimension_one"
    assert dimension.model_name == model_name
    assert dimension.explore_name == explore_name
    assert dimension.type == "number"
    assert dimension.url == "/projects/spectacles/files/test_view.view.lkml?line=340"
    assert dimension.sql == "${TABLE}.dimension_one "
    assert not dimension.ignore
def test_issue_5_svd_converges():
    """Source: https://github.com/miso-belica/sumy/issues/5"""
    pytest.skip("Can't reproduce the issue.")

    parser = PlaintextParser.from_string(
        load_resource("articles/svd_converges.txt"),
        Tokenizer("english")
    )
    summarizer = LsaSummarizer(Stemmer("english"))
    summarizer.stop_words = get_stop_words("english")

    sentences = summarizer(parser.document, 20)
    assert len(sentences) == 20
예제 #6
0
 def _get_custom_scenario_xml(self, filename):
     data = load_resource(filename)
     return "<vertical_demo><drag-and-drop-v2 data='{data}'/></vertical_demo>".format(
         data=escape(data, self._additional_escapes))
 def get_data_response(self):
     return json.loads(load_resource('data/test_get_data.json'))
 def initial_data(self):
     return json.loads(load_resource('data/test_data.json'))
 def get_data_response(self):
     return json.loads(load_resource('data/test_get_data.json'))
 def initial_data(self):
     return json.loads(load_resource('data/test_data.json'))
예제 #11
0
def test_model_from_json():
    json_dict = load_resource("response_models.json")
    model = Model.from_json(json_dict[0])
    assert model.name == "test_model_one"
    assert model.project_name == "test_project"
    assert [e.name for e in model.explores] == ["test_explore_one"]
예제 #12
0
def schema():
    return load_resource("validation_schema.json")