Пример #1
0
 def test_description(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-jsonld.html'))
     assert parser.job_advert.description == "Description: ABC Company Inc. seeks a full-time mid-level software engineer to develop in-house tools."
Пример #2
0
 def test_salary_unclear(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-jsonld-salary-unclear.html'))
     assert parser.get_result('salary-clarity')['result'] == 'unclear'
Пример #3
0
 def test_description(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-microdata.html'))
     assert parser.job_advert.description == """Description:
Пример #4
0
 def test_sentance_too_short_for_flesch_reading_ease(self):
     test_string = "A test"
     assert None == Parser.calculate_flesch_reading_ease(test_string)
Пример #5
0
    def test_employment_type(self):
        parser = Parser()
        parser.parse(read_test_case('schemaorg-jsonld.html'))
        assert parser.job_advert.employment_type == 'Full-time'

        assert parser.get_result('has-employment-type')['result'] == True
Пример #6
0
 def test_publishing_format(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-rdfa.html'))
     assert parser.job_advert.publishing_format == "rdfa"
Пример #7
0
 def test_invalid_jobPosting_text(self):
     assert False == Parser.has_jobposting(read_test_case('test.txt'))        
Пример #8
0
    def test_location_clear(self):
        parser = Parser()
        parser.parse(read_test_case('schemaorg-jsonld-location-clear.html')) 
        assert parser.job_advert.address == 'Somerset House, Strand, London WC2R 1LA, London'

        assert parser.get_result('location-clarity')['result'] == 'clear'
Пример #9
0
 def test_valid_jobPosting_rdfa(self):
     assert True == Parser.has_jobposting(read_test_case('schemaorg-rdfa.html'))
Пример #10
0
 def test_invalid_jobPosting_html(self):
     assert False == Parser.has_jobposting(read_test_case('schemaorg-html.html'))
Пример #11
0
 def test_valid_jobPosting_jsonld(self):
     assert True == Parser.has_jobposting(read_test_case('schemaorg-jsonld.html'))
Пример #12
0
 def test_check_creative_commons_licence_link(self):
     parser = Parser()
     parser.parse(read_test_case('licence-link.html'))
     assert parser.job_advert.creative_commons_licences == [{'name': 'Creative Commons Attribution', 'url': 'http://creativecommons.org/licenses/by-nd/4.0'}]
     assert parser.get_result('creative-commons-licence')['result'] == True
Пример #13
0
 def test_salary_clear(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-microdata-salary-clear.html'))
     assert parser.get_result('salary-clarity')['result'] == 'clear'
Пример #14
0
 def test_salary_missing(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-jsonld-salary-missing.html'))
     assert parser.get_result('salary-clarity')['result'] == 'missing'
Пример #15
0
 def test_neutral(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-microdata-gender-coding-neutral.html'))
     assert parser.get_result('gender-coded-language')['result'] == 'neutral'
Пример #16
0
    def test_location_unclear(self):
        parser = Parser()
        parser.parse(read_test_case('schemaorg-jsonld.html')) 
        assert parser.job_advert.address == 'Kirkland, WA'

        assert parser.get_result('location-clarity')['result'] == 'unclear'
Пример #17
0
 def test_feminine(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-microdata-gender-coding-feminine.html'))
     assert 'feminine' in parser.get_result('gender-coded-language')['result']
Пример #18
0
    def test_location_missing(self):
        parser = Parser()
        parser.parse(read_test_case('schemaorg-jsonld-location-missing.html')) 
        assert parser.job_advert.address == None

        assert parser.get_result('location-clarity')['result'] == 'missing'
Пример #19
0
 def test_parser(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-microdata.html'))
     assert parser.get_result('flesch-reading-ease')['result']
Пример #20
0
 def test_employment_type_missing(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-rdfa-employment-type-missing.html'))
     assert parser.get_result('has-employment-type')['result'] == False
Пример #21
0
 def test_calculate_flesch_reading_ease(self):
     test_string = "The Australian platypus is seemingly a hybrid of a mammal and reptilian creature"
     assert 49.82 == Parser.calculate_flesch_reading_ease(test_string)
Пример #22
0
 def test_title(self):
     parser = Parser()
     parser.parse(read_test_case('schemaorg-rdfa.html'))
     assert parser.job_advert.title == "Software Engineer"
Пример #23
0
 def test_check_creative_commons_licence_link(self):
     licences = Parser.check_creative_commons_licence(read_test_case('licence-link.html'))
     assert licences == [{'name': 'Creative Commons Attribution', 'url': 'http://creativecommons.org/licenses/by-nd/4.0'}]