def test_33(self): s1 = "div#page.container div#columns.clearfix div#leadspot.clearfix.grid-16 div#block-ec_homepage-ec_homepage_superhero.block.block-ec_homepage div.clearfix.content div#superhero.clearfix div.hero-superhero ul#hero.hero-multiple li.selected div.hero-item.hero-item-4 a.hero-tab.omniture-tagged.omniture-tagged-127 p.headline" s2 = "div#page.container div#columns.clearfix div#column-content.clearfix.grid-10.grid-first div.grid-7.grid-first.push-3 div#homepage-center-inner section.news-package.typog-package article a.omniture-tagged.omniture-tagged-20 div h2.headline" expected = 25 self.assertEqual(dom.distance(s1, s2), expected)
def test_tag_substitution(self): s1 = "div" s2 = "a" expected = 1 self.assertEqual(dom.distance(s1, s2), expected)
def test_14(self): s1 = "a#id.btn" s2 = "div#id span.text a#link.btn" expected = 6 self.assertEqual(dom.distance(s1, s2), expected)
def test_same_with_id(self): s1 = "div#id" s2 = "div#id" expected = 0 self.assertEqual(dom.distance(s1, s2), expected)
def test_same(self): s1 = "div" s2 = "div" expected = 0 self.assertEqual(dom.distance(s1, s2), expected)
def test_11(self): s1 = "a#a a#b a#d" s2 = "a#a a#b a#c a#d" expected = 2 self.assertEqual(dom.distance(s1, s2), expected)
def test_28(self): s1 = "div div#cnn_maincntnr div.cnn_contentarea.cnn_shdcamtt12010.cnn_shdcamtt1l250.cnn_t1lo_bnews.cnn_t1lo_refresh div#cnn_maintopt1 div#cnn_maint1lftf.breaking div#cnn_maintt1imgbul div.cnn_main10t1cntnt div.cnn_main10t1lcntr div.cnn_main10t1sbbin2c ul.cnn_bulletbin li.c_hpbullet4 a" s2 = "div div#cnn_maincntnr div.cnn_contentarea.cnn_shdcamtt12010.cnn_shdcamtt1l250.cnn_t1lo_bnews.cnn_t1lo_refresh div#cnn_maintopt1 div#cnn_maint1lftf.breaking div#cnn_maintt1imgbul div.cnn_main10t1cntnt div.cnn_main10t1lcntr div div.cnn_main10t1stxt div#cnn_tc_t1_rich_text div.cnn_two_column_t_rich_text" expected = 9 self.assertEqual(dom.distance(s1, s2), expected)
def test_7(self): s1 = "div#id.btn" s2 = "div" expected = 2 self.assertEqual(dom.distance(s1, s2), expected)
def test_26(self): s1 = "header.cf.header div.nav-bar div.lc form.search-form fieldset input.search-field" s2 = "header.cf.header div.nav-bar div.lc div.header-social ul.inline-list.social-list.sprite-social" expected = 8 self.assertEqual(dom.distance(s1, s2), expected)
def test_27(self): s1 = "header.cf.header div.nav-bar div.lc form.search-form fieldset input.search-field" s2 = "div.fluid.flush.homepage.split div.flush.lc.lc-island div.l-two-col div.l-main-container div.l-main ul#river1.lc-padding.river li#905418.river-block div.block.block-thumb div.block-content p.excerpt" expected = 30 self.assertEqual(dom.distance(s1, s2), expected)
def test_25(self): s1 = "div#masthead.billboard-layout.cf.main-col div#yui_3_8_1_1_1382751082490_1862.main-row-wrapper div#default-p_13838465.mod.view_default div#default-p_13838465-bd.bd.type_masthead.type_masthead_default div#yui_3_8_1_1_1382751082490_1861.clearfix.lightbg.mh-wrap.us.y-fp-pg-grad form#p_13838465-searchform.search-form fieldset#yui_3_8_1_1_1382751082490_1860.compact-enabled-fieldset div#p_13838465-searchwrapper.searchwrapper.selected.tabpanel div#yui_3_8_1_1_1382751082490_1859.focus.searchwrapper-border.y-srch-brdr div#fp-search-bdr.brdr-focus.clearfix.searchwrapper-inner.y-glbl-srch-bg-img div#yui_3_8_1_1_1382751082490_1858.input-wrapper input#p_13838465-p.compact-input-enabled.input-long.input-query.med-large" s2 = "div#masthead.billboard-layout.cf.main-col div#yui_3_8_1_1_1382751082490_1862.main-row-wrapper div#default-p_13838465.mod.view_default div#default-p_13838465-bd.bd.type_masthead.type_masthead_default div#yui_3_8_1_1_1382751082490_1861.clearfix.lightbg.mh-wrap.us.y-fp-pg-grad form#p_13838465-searchform.search-form fieldset#yui_3_8_1_1_1382751082490_1860.compact-enabled-fieldset div#p_13838465-searchwrapper.searchwrapper.selected.tabpanel div#yui_3_8_1_1_1382751082490_1859.searchwrapper-border.y-srch-brdr div#fp-search-bdr.clearfix.searchwrapper-inner.y-glbl-srch-bg-img div#yui_3_8_1_1_1382751082490_1858.input-wrapper input#p_13838465-p.compact-input-enabled.input-long.input-query.med-large" expected = 2 self.assertEqual(dom.distance(s1, s2), expected)
def test_24(self): s1 = "div#nav-col.billboard-layout.cf.main-row div#yui_3_8_1_1_1382751082490_1382.main-col-wrapper div#hero-col.main-col1 div#yui_3_8_1_1_1382751082490_1381.hero-col-wrapper div#stream div#default-p_30345786.mod.view_default div#default-p_30345786-bd.bd.type_stream.type_stream_default ul#yui_3_8_1_1_1382751082490_1533 li#yui_3_8_1_1_1382751082490_1718.cf.content.has-image.voh-parent div#yui_3_8_1_1_1382751082490_1717.cf.wrapper div#yui_3_8_1_1_1382751082490_1716.body div#yui_3_8_1_1_1382751082490_1715.body-wrap p#yui_3_8_1_1_1382751082490_1740.mt-xxs.summary" s2 = "div#nav-col.billboard-layout.cf.main-row div#yui_3_8_1_1_1382751082490_1382.main-col-wrapper div#hero-col.main-col1 div#yui_3_8_1_1_1382751082490_1381.hero-col-wrapper div#stream div#default-p_30345786.mod.view_default div#default-p_30345786-bd.bd.type_stream.type_stream_default ul#yui_3_8_1_1_1382751082490_1533 li#yui_3_8_1_1_1382751082490_1532.cf.content.voh-parent div#yui_3_8_1_1_1382751082490_1531.cf.wrapper div#yui_3_8_1_1_1382751082490_1530.body div#yui_3_8_1_1_1382751082490_1529.body-wrap p#yui_3_8_1_1_1382751082490_1554.mt-xxs.summary" expected = 11 self.assertEqual(dom.distance(s1, s2), expected)
def test_23(self): s1 = "a#enter" s2 = "a#enter.knob.green a#enter a#enter" expected = 6 self.assertEqual(dom.distance(s1, s2), expected)
def test_id_deletion(self): s1 = "div#id" s2 = "div" expected = 1 self.assertEqual(dom.distance(s1, s2), expected)
def test_same_classes(self): s1 = "div#id.cls.btn" s2 = "div#id.btn.cls" expected = 0 self.assertEqual(dom.distance(s1, s2), expected)
def test_class_addition(self): s1 = "div#id" s2 = "div#id.id" expected = 1 self.assertEqual(dom.distance(s1, s2), expected)
def test_29(self): s1 = "div div#cnn_maincntnr div.cnn_contentarea.cnn_shdcamtt12010.cnn_shdcamtt1l250.cnn_t1lo_bnews.cnn_t1lo_refresh div#cnn_maintopt1 div#cnn_maintoplive div.cnn_mc2cntr div.cnn_mc23x1cnntr div#cnn_mc2_large1.cnn_mc2_img_right.cnn_mc2_large div div.cnn_mc2_text_left div.cnn_mc2_blurb a" s2 = "div div#cnn_maincntnr div.cnn_contentarea.cnn_shdcamtt12010.cnn_shdcamtt1l250.cnn_t1lo_bnews.cnn_t1lo_refresh div#cnn_maintopprofile div#on_tv.cnn_hppersonal div#cnn_pmtvmodule div.cnn_hppersonalfeature div.cnn_pmtvmodddown.cnn_tsbnav form select" expected = 16 self.assertEqual(dom.distance(s1, s2), expected)
def test_8(self): s1 = "div#id.btn" s2 = "a.blue" expected = 3 self.assertEqual(dom.distance(s1, s2), expected)
def test_30(self): s1 = "div#shell div#page.active.tabContent div#main div.baseLayout.wrap div.column.last div.layout.spanAB div.abColumn.column div.layout.module.wideB div.aColumn.column.opening div.columnGroup div.story p.summary" s2 = "div#page.active.tabContent div#main div.baseLayout.wrap div.column.last div.layout.spanAB div.abColumn.column div.layout.module.wideB div.aColumn.column.opening div.columnGroup.first div.story p.summary" expected = 2 self.assertEqual(dom.distance(s1, s2), expected)
def test_9(self): s1 = "div#id.btn.blue" s2 = "div.blue.btn" expected = 1 self.assertEqual(dom.distance(s1, s2), expected)
def test_31(self): s1 = "div#shell div#page.active.tabContent div#toolbar div#toolbarSearchContainer.toolbarSearchContainer-withad div#toolbarSearch.toolbarSearchActive div.inlineSearchControl form#searchForm input#hpSearchQuery.text" s2 = "div#shell div#page.active.tabContent div#toolbar div#toolbarSearchContainer.toolbarSearchContainer-withad div#toolbarSearch div.inlineSearchControl form#searchForm input#hpSearchQuery.text" expected = 1 self.assertEqual(dom.distance(s1, s2), expected)
def test_12(self): s1 = "a.btn" s2 = "div#id img.photo" expected = 5 self.assertEqual(dom.distance(s1, s2), expected)
def test_32(self): s1 = "header.mh div.mh-stripe div.mh-stripe-wrap ul.mh-user-menu li.last a.omniture-tagged.omniture-tagged-291.show-login" s2 = "div.ec-overlay div.login-wrap form#user-login.clearfix.context-user_login.ec-social.user-form div div#edit-name-wrapper.clearfix.form-item input#edit-name.form-email.form-text.required" expected = 24 self.assertEqual(dom.distance(s1, s2), expected)
def test_16(self): s1 = "a.btn div#id img.photo" s2 = "div#id img.photo.bw a.btn.share.link" expected = 6 self.assertEqual(dom.distance(s1, s2), expected)
def test_18(self): s1 = "div#id.btn.blue a#enter" s2 = "a#enter.knob.green" expected = 3 self.assertEqual(dom.distance(s1, s2), expected)