2014-05-26 16:50:58 +02:00
# -*- coding: utf8 -*-
# -----------------------------------------------------------------------------
# "THE NO-ALCOHOL BEER-WARE LICENSE" (Revision 42):
# Phyks (webmaster@phyks.me) wrote this file. As long as you retain this notice
# you can do whatever you want with this stuff (and you can also do whatever
# you want with this stuff without retaining it, but that's not cool...). If we
# meet some day, and you think this stuff is worth it, you can buy me a
# <del>beer</del> soda in return.
# Phyks
# -----------------------------------------------------------------------------
2014-06-08 18:54:24 +02:00
import unittest
from backend import *
2014-06-11 14:37:10 +02:00
from bibtexparser . bparser import BibTexParser
import shutil
import tempfile
2014-06-08 18:54:24 +02:00
class TestFetcher ( unittest . TestCase ) :
2014-06-11 14:37:10 +02:00
def setUp ( self ) :
params . folder = tempfile . mkdtemp ( ) + " / "
self . bibtex_article_string = """
@article { 1303.3130 v1 ,
abstract = { We study the role of the dipolar interaction , correctly accounting for the
Dipolar - Induced Resonance ( DIR ) , in a quasi - one - dimensional system of ultracold
bosons . We first show how the DIR affects the lowest - energy states of two
particles in a harmonic trap . Then , we consider a deep optical lattice loaded
with ultracold dipolar bosons . We describe this many - body system using an
atom - dimer extended Bose - Hubbard model . We analyze the impact of the DIR on the
phase diagram at T = 0 by exact diagonalization of a small - sized system . In
particular , the resonance strongly modifies the range of parameters for which a
mass density wave should occur . } ,
archiveprefix = { arXiv } ,
author = { N . Bartolo and D . J . Papoular and L . Barbiero and C . Menotti and A . Recati } ,
eprint = { 1303.3130 v1 } ,
file = { / home / phyks / Papers / N_Bartolo_A_Recati - j - 2013. pdf } ,
link = { http : / / arxiv . org / abs / 1303.3130 v1 } ,
month = { Mar } ,
primaryclass = { cond - mat . quant - gas } ,
tag = { } ,
title = { Dipolar - Induced Resonance for Ultracold Bosons in a Quasi - 1 D Optical
Lattice } ,
year = { 2013 } ,
} """
self . bibtex_article = BibTexParser ( self . bibtex_article_string ) . get_entry_dict ( )
self . bibtex_article = self . bibtex_article [ self . bibtex_article . keys ( ) [ 0 ] ]
self . bibtex_book_string = """
"""
self . bibtex_book = BibTexParser ( self . bibtex_book_string ) . get_entry_dict ( )
self . bibtex_book = self . bibtex_book [ self . bibtex_book . keys ( ) [ 0 ] ]
def test_getNewName_article ( self ) :
self . assertEqual ( getNewName ( " test.pdf " , self . bibtex_article ) ,
params . folder + " N_Bartolo_A_Recati-j-2013-v1.pdf " )
def test_getNewName_article_override ( self ) :
self . assertEqual ( getNewName ( " test.pdf " , self . bibtex_article , override_format = " %f " ) ,
params . folder + " N_Bartolo.pdf " )
def test_getNewName_book ( self ) :
# TODO
self . assertEqual ( getNewName ( " test.pdf " , self . bibtex_book ) ,
params . folder + " " )
def test_getNewName_book_override ( self ) :
# TODO
self . assertEqual ( getNewName ( " test.pdf " , self . bibtex_book , override_format = " %a " ) ,
params . folder + " N_Bartolo.pdf " )
2014-06-08 18:54:24 +02:00
def test_bibtexAppend ( self ) :
2014-06-11 14:37:10 +02:00
bibtexAppend ( self . bibtex )
with open ( params . folder + ' index.bib ' , ' r ' ) as fh :
self . assertEqual ( fh . read ( ) ,
' @article { 1303.3130v1, \n \t abstract= { We study the role of the dipolar interaction, correctly accounting for the \n Dipolar-Induced Resonance (DIR), in a quasi-one-dimensional system of ultracold \n bosons. We first show how the DIR affects the lowest-energy states of two \n particles in a harmonic trap. Then, we consider a deep optical lattice loaded \n with ultracold dipolar bosons. We describe this many-body system using an \n atom-dimer extended Bose-Hubbard model. We analyze the impact of the DIR on the \n phase diagram at T=0 by exact diagonalization of a small-sized system. In \n particular, the resonance strongly modifies the range of parameters for which a \n mass density wave should occur.}, \n \t archiveprefix= {arXiv} , \n \t author= { N. Bartolo and D. J. Papoular and L. Barbiero and C. Menotti and A. Recati}, \n \t eprint= {1303.3130v1} , \n \t file= { /home/phyks/Papers/N_Bartolo_A_Recati-j-2013.pdf}, \n \t link= { http://arxiv.org/abs/1303.3130v1}, \n \t month= {Mar} , \n \t primaryclass= { cond-mat.quant-gas}, \n \t tag= {} , \n \t title= { Dipolar-Induced Resonance for Ultracold Bosons in a Quasi-1D Optical \n Lattice}, \n \t year= {2013} , \n } \n \n \n ' )
2014-06-08 18:54:24 +02:00
def test_bibtexEdit ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_bibtexRewrite ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_deleteId ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_deleteFile ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_diffFilesIndex ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_getBibtex ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_getEntries ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
def test_updateArxiv ( self ) :
2014-06-11 14:37:10 +02:00
# TODO
2014-06-08 18:54:24 +02:00
return
2014-06-11 14:37:10 +02:00
def tearDown ( self ) :
shutil . rmtree ( params . folder )
2014-06-08 18:54:24 +02:00
if __name__ == ' __main__ ' :
unittest . main ( )