def test_gb3(self): """Non-ascii characters in title""" o = googlebooks_sfn_cit_ref( 'http://books.google.com/books?' 'id=icMEAAAAQBAJ&pg=PA588&dq=%22a+Delimiter+is%22&hl=' 'en&sa=X&ei=oNKSUrKeDovItAbO_4CoBA&ved=0CC4Q6AEwAA#v=' 'onepage&q=%22a%20Delimiter%20is%22&f=false' ) self.assertIn( '<ref>' '{{پک | Farrell | 2009 ' '| ک=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming |' ' زبان=en | ص=588}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Farrell |' ' نام=J. | عنوان=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming |' ' ناشر=Cengage Learning | سال=2009 | شابک=978-1-111-78619-9 |' ' پیوند=https://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588 |' ' زبان=en | تاریخ بازبینی=', o[1], )
def test_gb4(self): """Non-ascii characters in author's name.""" o = googlebooks_sfn_cit_ref( 'http://books.google.com/books?id=' 'i8nZjjo_9ikC&pg=PA229&dq=%22legal+translation+is%22&hl=en&sa=' 'X&ei=hEuYUr_mOsnKswb49oDQCA&ved=0CC4Q6AEwAA#v=onepage&q=' '%22legal%20translation%20is%22&f=false') self.assertIn( '<ref>{{پک | Šarčević | 1997 ' '| ک=New Approach to Legal Translation |' ' زبان=en | ص=229}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Šarčević |' ' نام=S. |' ' عنوان=New Approach to Legal Translation |' ' ناشر=Springer Netherlands |' ' سال=1997 |' ' شابک=978-90-411-0401-4 |' ' پیوند=https://books.google.com/books?id=i8nZjjo_9ikC&pg=PA229 |' ' زبان=en |' ' تاریخ بازبینی=', o[1], )
def test_gb4(self): """Non-ascii characters in author's name.""" o = googlebooks_sfn_cit_ref( 'http://books.google.com/books?id=' 'i8nZjjo_9ikC&pg=PA229&dq=%22legal+translation+is%22&hl=en&sa=' 'X&ei=hEuYUr_mOsnKswb49oDQCA&ved=0CC4Q6AEwAA#v=onepage&q=' '%22legal%20translation%20is%22&f=false' ) self.assertIn( '<ref>{{پک | Šarčević | 1997 ' '| ک=New Approach to Legal Translation |' ' زبان=en | ص=229}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Šarčević |' ' نام=S. |' ' عنوان=New Approach to Legal Translation |' ' ناشر=Springer Netherlands |' ' سال=1997 |' ' شابک=978-90-411-0401-4 |' ' پیوند=https://books.google.com/books?id=i8nZjjo_9ikC&pg=PA229 |' ' زبان=en |' ' تاریخ بازبینی=', o[1], )
def test_gb3(self): """Non-ascii characters in title""" o = googlebooks_sfn_cit_ref( 'http://books.google.com/books?' 'id=icMEAAAAQBAJ&pg=PA588&dq=%22a+Delimiter+is%22&hl=' 'en&sa=X&ei=oNKSUrKeDovItAbO_4CoBA&ved=0CC4Q6AEwAA#v=' 'onepage&q=%22a%20Delimiter%20is%22&f=false') self.assertIn( '<ref>' '{{پک | Farrell | 2009 ' '| ک=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming |' ' زبان=en | ص=588}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Farrell |' ' نام=J. | عنوان=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming |' ' ناشر=Cengage Learning | سال=2009 | شابک=978-1-111-78619-9 |' ' پیوند=https://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588 |' ' زبان=en | تاریخ بازبینی=', o[1], )
def test_gb1(self): self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Arms |' ' نام=W.Y. | عنوان=Digital Libraries | ناشر=MIT Press |' ' سری=Digital libraries and electronic publishing |' ' سال=2001 | شابک=978-0-262-26134-0 |' ' پیوند=https://books.google.com/books?id=pzmt3pcBuGYC&pg=PR11 |' ' زبان=en | تاریخ بازبینی=', googlebooks_sfn_cit_ref( 'http://books.google.com/books?' 'id=pzmt3pcBuGYC&pg=PR11&lpg=PP1&dq=digital+library')[1], )
def test_gb1(self): self.assertIn( '* {{یادکرد کتاب | نام خانوادگی=Arms |' ' نام=W.Y. | عنوان=Digital Libraries | ناشر=MIT Press |' ' سری=Digital libraries and electronic publishing |' ' سال=2001 | شابک=978-0-262-26134-0 |' ' پیوند=https://books.google.com/books?id=pzmt3pcBuGYC&pg=PR11 |' ' زبان=en | تاریخ بازبینی=', googlebooks_sfn_cit_ref( 'http://books.google.com/books?' 'id=pzmt3pcBuGYC&pg=PR11&lpg=PP1&dq=digital+library' )[1], )
def test_gb2(self): """a book with more than 4 authors (10 authors)""" i = ( 'http://books.google.com/books?' 'id=U46IzqYLZvAC&pg=PT57#v=onepage&q&f=false' ) o = googlebooks_sfn_cit_ref(i) e1 = ( '{{sfn ' '| Anderson ' '| DeBolt ' '| Featherstone ' '| Gunther ' '| 2010 ' '| p=57}}' ) e2 = ( '* {{cite book ' '| last=Anderson ' '| first=E. ' '| last2=DeBolt ' '| first2=V. ' '| last3=Featherstone ' '| first3=D. ' '| last4=Gunther ' '| first4=L. ' '| last5=Jacobs ' '| first5=D.R. ' '| last6=Mills ' '| first6=C. ' '| last7=Schmitt ' '| first7=C. ' '| last8=Sims ' '| first8=G. ' '| last9=Walter ' '| first9=A. ' '| last10=Jensen-Inman ' '| first10=L. ' '| title=InterACT with Web Standards: ' 'A holistic approach to web design ' '| publisher=Pearson Education ' '| series=Voices That Matter ' '| year=2010 ' '| isbn=978-0-13-270490-8 ' '| url=https://books.google.com/books?id=U46IzqYLZvAC&pg=PT57 ' '| ref=harv ' '| access-date=' ) self.assertIn(e1, o[0]) self.assertIn(e2, o[1])
def test_gb1(self): i = ('http://books.google.com/books?' 'id=pzmt3pcBuGYC&pg=PR11&lpg=PP1&dq=digital+library') o = googlebooks_sfn_cit_ref(i) e = ('* {{cite book ' '| last=Arms ' '| first=W.Y. ' '| title=Digital Libraries ' '| publisher=MIT Press ' '| series=Digital libraries and electronic publishing ' '| year=2001 ' '| isbn=978-0-262-26134-0 ' '| url=https://books.google.com/books?id=pzmt3pcBuGYC&pg=PR11 ' '| ref=harv ' '| access-date=') self.assertIn(e, o[1])
def test_gb2(self): """a book with more than 4 authors (10 authors)""" i = ('http://books.google.com/books?' 'id=U46IzqYLZvAC&pg=PT57#v=onepage&q&f=false') o = googlebooks_sfn_cit_ref(i) e1 = ('{{sfn ' '| Anderson ' '| DeBolt ' '| Featherstone ' '| Gunther ' '| 2010 ' '| p=57}}') e2 = ('* {{cite book ' '| last=Anderson ' '| first=E. ' '| last2=DeBolt ' '| first2=V. ' '| last3=Featherstone ' '| first3=D. ' '| last4=Gunther ' '| first4=L. ' '| last5=Jacobs ' '| first5=D.R. ' '| last6=Mills ' '| first6=C. ' '| last7=Schmitt ' '| first7=C. ' '| last8=Sims ' '| first8=G. ' '| last9=Walter ' '| first9=A. ' '| last10=Jensen-Inman ' '| first10=L. ' '| title=InterACT with Web Standards: ' 'A holistic approach to web design ' '| publisher=Pearson Education ' '| series=Voices That Matter ' '| year=2010 ' '| isbn=978-0-13-270490-8 ' '| url=https://books.google.com/books?id=U46IzqYLZvAC&pg=PT57 ' '| ref=harv ' '| access-date=') self.assertIn(e1, o[0]) self.assertIn(e2, o[1])
def test_gb5(self): """ref checking""" i = ( 'https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378&' 'dq=density+of+granite&hl=en&sa=X&ei=YBHIU-qCBIyX0QXusoDgAg&ved=' '0CEIQ6AEwBjgK#v=onepage&q=density%20of%20granite&f=false' ) o = googlebooks_sfn_cit_ref(i) ctnt = ( '* {{cite book ' '| last=Serway ' '| first=R.A. ' '| last2=Jewett ' '| first2=J.W. ' '| title=Physics for Scientists and Engineers, Volume 1, ' 'Chapters 1-22 | publisher=Cengage Learning ' '| series=Physics for Scientists and Engineers ' '| year=2009 ' '| isbn=978-1-4390-4838-2 ' '| url=https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378' ' ' '| ref=harv ' '| access-date=' ) reft = ( '<ref name="Serway Jewett 2009 p. 378">' '{{cite book ' '| last=Serway ' '| first=R.A. ' '| last2=Jewett ' '| first2=J.W. ' '| title=Physics for Scientists and Engineers, Volume 1, ' 'Chapters 1-22 | publisher=Cengage Learning ' '| series=Physics for Scientists and Engineers ' '| year=2009 ' '| isbn=978-1-4390-4838-2 ' '| url=https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378' ' ' '| access-date=' ) self.assertIn(ctnt, o[1]) self.assertIn(reft, o[2]) self.assertIn(' | page=378}}</ref>', o[2])
def test_gb3(self): """Non-ascii characters in title (Some of them where removed later)""" i = ('http://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588&dq=%22a+' 'Delimiter+is%22&hl=en&sa=X&ei=oNKSUrKeDovItAbO_4CoBA&ved=' '0CC4Q6AEwAA#v=onepage&q=%22a%20Delimiter%20is%22&f=false') o = googlebooks_sfn_cit_ref(i) e1 = '{{sfn | Farrell | 2009 | p=588}}' e2 = ('* {{cite book ' '| last=Farrell ' '| first=J. ' '| title=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming ' '| publisher=Cengage Learning ' '| year=2009 ' '| isbn=978-1-111-78619-9 ' '| url=https://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588 ' '| ref=harv ' '| access-date=') self.assertIn(e1, o[0]) self.assertIn(e2, o[1])
def test_gb1(self): i = ( 'http://books.google.com/books?' 'id=pzmt3pcBuGYC&pg=PR11&lpg=PP1&dq=digital+library' ) o = googlebooks_sfn_cit_ref(i) e = ( '* {{cite book ' '| last=Arms ' '| first=W.Y. ' '| title=Digital Libraries ' '| publisher=MIT Press ' '| series=Digital libraries and electronic publishing ' '| year=2001 ' '| isbn=978-0-262-26134-0 ' '| url=https://books.google.com/books?id=pzmt3pcBuGYC&pg=PR11 ' '| ref=harv ' '| access-date=' ) self.assertIn(e, o[1])
def test_gb4(self): """Non-ascii characters in author's name.""" i = ('https://books.google.com/books?id=' 'i8nZjjo_9ikC&pg=PA229&dq=%22legal+translation+is%22&hl=en&sa=' 'X&ei=hEuYUr_mOsnKswb49oDQCA&ved=0CC4Q6AEwAA#v=onepage&q=' '%22legal%20translation%20is%22&f=false') o = googlebooks_sfn_cit_ref(i) e1 = '{{sfn | Šarčević | 1997 | p=229}}' e2 = ('* {{cite book ' '| last=Šarčević ' '| first=S. ' '| title=New Approach to Legal Translation ' '| publisher=Springer Netherlands ' '| year=1997 ' '| isbn=978-90-411-0401-4 ' '| url=https://books.google.com/books?id=i8nZjjo_9ikC&pg=PA229 ' '| ref=harv ' '| access-date=') self.assertIn(e1, o[0]) self.assertIn(e2, o[1])
def test_gb5(self): """ref checking""" i = ('https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378&' 'dq=density+of+granite&hl=en&sa=X&ei=YBHIU-qCBIyX0QXusoDgAg&ved=' '0CEIQ6AEwBjgK#v=onepage&q=density%20of%20granite&f=false') o = googlebooks_sfn_cit_ref(i) ctnt = ( '* {{cite book ' '| last=Serway ' '| first=R.A. ' '| last2=Jewett ' '| first2=J.W. ' '| title=Physics for Scientists and Engineers, Volume 1, ' 'Chapters 1-22 | publisher=Cengage Learning ' '| series=Physics for Scientists and Engineers ' '| year=2009 ' '| isbn=978-1-4390-4838-2 ' '| url=https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378' ' ' '| ref=harv ' '| access-date=') reft = ( '<ref name="Serway Jewett 2009 p. 378">' '{{cite book ' '| last=Serway ' '| first=R.A. ' '| last2=Jewett ' '| first2=J.W. ' '| title=Physics for Scientists and Engineers, Volume 1, ' 'Chapters 1-22 | publisher=Cengage Learning ' '| series=Physics for Scientists and Engineers ' '| year=2009 ' '| isbn=978-1-4390-4838-2 ' '| url=https://encrypted.google.com/books?id=6upvonUt0O8C&pg=PA378' ' ' '| access-date=') self.assertIn(ctnt, o[1]) self.assertIn(reft, o[2]) self.assertIn(' | page=378}}</ref>', o[2])
def test_gb2(self): """a book with more than 4 authors (10 authors)""" o = googlebooks_sfn_cit_ref( 'http://books.google.com/books?id=' 'U46IzqYLZvAC&pg=PT57#v=onepage&q&f=false') self.assertIn( '<ref>' '{{پک | Anderson | DeBolt | Featherstone | Gunther | 2010' ' | ک=InterACT with Web Standards: A' ' holistic approach to web design | زبان=en | ص=57}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب |' ' نام خانوادگی=Anderson |' ' نام=E. |' ' نام خانوادگی۲=DeBolt | نام۲=V. |' ' نام خانوادگی۳=Featherstone |' ' نام۳=D. | نام خانوادگی۴=Gunther |' ' نام۴=L. |' ' نام خانوادگی۵=Jacobs | نام۵=D.R. | نام خانوادگی۶=Mills |' ' نام۶=C. |' ' نام خانوادگی۷=Schmitt | نام۷=C. | نام خانوادگی۸=Sims |' ' نام۸=G. |' ' نام خانوادگی۹=Walter | نام۹=A. |' ' نام خانوادگی۱۰=Jensen-Inman |' ' نام۱۰=L. |' ' عنوان=InterACT with Web Standards:' ' A holistic approach to web design |' ' ناشر=Pearson Education |' ' سری=Voices That Matter | سال=2010 |' ' شابک=978-0-13-270490-8 |' ' پیوند=https://books.google.com/books?id=U46IzqYLZvAC&pg=PT57 |' ' زبان=en |' ' تاریخ بازبینی=', o[1], )
def test_gb2(self): """a book with more than 4 authors (10 authors)""" o = googlebooks_sfn_cit_ref('http://books.google.com/books?id=' 'U46IzqYLZvAC&pg=PT57#v=onepage&q&f=false') self.assertIn( '<ref>' '{{پک | Anderson | DeBolt | Featherstone | Gunther | 2010' ' | ک=InterACT with Web Standards: A' ' holistic approach to web design | زبان=en | ص=57}}' '\u200f</ref>', o[0], ) self.assertIn( '* {{یادکرد کتاب |' ' نام خانوادگی=Anderson |' ' نام=E. |' ' نام خانوادگی۲=DeBolt | نام۲=V. |' ' نام خانوادگی۳=Featherstone |' ' نام۳=D. | نام خانوادگی۴=Gunther |' ' نام۴=L. |' ' نام خانوادگی۵=Jacobs | نام۵=D.R. | نام خانوادگی۶=Mills |' ' نام۶=C. |' ' نام خانوادگی۷=Schmitt | نام۷=C. | نام خانوادگی۸=Sims |' ' نام۸=G. |' ' نام خانوادگی۹=Walter | نام۹=A. |' ' نام خانوادگی۱۰=Jensen-Inman |' ' نام۱۰=L. |' ' عنوان=InterACT with Web Standards:' ' A holistic approach to web design |' ' ناشر=Pearson Education |' ' سری=Voices That Matter | سال=2010 |' ' شابک=978-0-13-270490-8 |' ' پیوند=https://books.google.com/books?id=U46IzqYLZvAC&pg=PT57 |' ' زبان=en |' ' تاریخ بازبینی=', o[1], )
def test_gb3(self): """Non-ascii characters in title (Some of them where removed later)""" i = ( 'http://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588&dq=%22a+' 'Delimiter+is%22&hl=en&sa=X&ei=oNKSUrKeDovItAbO_4CoBA&ved=' '0CC4Q6AEwAA#v=onepage&q=%22a%20Delimiter%20is%22&f=false' ) o = googlebooks_sfn_cit_ref(i) e1 = '{{sfn | Farrell | 2009 | p=588}}' e2 = ( '* {{cite book ' '| last=Farrell ' '| first=J. ' '| title=Microsoft Visual C# 2008 Comprehensive: ' 'An Introduction to Object-Oriented Programming ' '| publisher=Cengage Learning ' '| year=2009 ' '| isbn=978-1-111-78619-9 ' '| url=https://books.google.com/books?id=icMEAAAAQBAJ&pg=PA588 ' '| ref=harv ' '| access-date=' ) self.assertIn(e1, o[0]) self.assertIn(e2, o[1])
def test_gb4(self): """Non-ascii characters in author's name.""" i = ( 'https://books.google.com/books?id=' 'i8nZjjo_9ikC&pg=PA229&dq=%22legal+translation+is%22&hl=en&sa=' 'X&ei=hEuYUr_mOsnKswb49oDQCA&ved=0CC4Q6AEwAA#v=onepage&q=' '%22legal%20translation%20is%22&f=false' ) o = googlebooks_sfn_cit_ref(i) e1 = '{{sfn | Šarčević | 1997 | p=229}}' e2 = ( '* {{cite book ' '| last=Šarčević ' '| first=S. ' '| title=New Approach to Legal Translation ' '| publisher=Springer Netherlands ' '| year=1997 ' '| isbn=978-90-411-0401-4 ' '| url=https://books.google.com/books?id=i8nZjjo_9ikC&pg=PA229 ' '| ref=harv ' '| access-date=' ) self.assertIn(e1, o[0]) self.assertIn(e2, o[1])