
,]c           @   s   d  Z  d d l Z d d l m Z d d l m Z e j d    Z d   Z d   Z	 d   Z
 d	   Z e d
 k r e j   n  d S(   s   
Tests for config/user.py
iN(   t
   UserConfig(   t   PY2c      
      sz   | j  d   f d      j d  } d } t rA | d 7} n
 | d 7} | j |  t d d i  d	 t d
 d d t S(   Ns    spyder.config.user.get_conf_pathc              s
   t     S(   N(   t   str(    (   t   tmpdir(    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt   <lambda>   t    s   foo.inis   [main]
version = 1.0.0

s   [section]
option = 'value'

s   [section]
option = value

t   foot   defaultst	   subfoldert   versions   1.0.0t   raw_mode(   t   setattrt   joinR   t   writeR    t   True(   R   t   monkeypatcht   inifilet   iniContents(    (   R   s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt
   userconfig   s    
c         C   s5   |  j  d d d  |  j d d  d k s1 t  d S(   s!   Test to set an option with a '%'.t   sectiont   options   %valueN(   t   sett   gett   AssertionError(   R   (    (    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt%   test_userconfig_set_percentage_string    s    c         C   s"   |  j  d d  d k s t  d  S(   NR   R   t   value(   R   R   (   R   (    (    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt'   test_userconfig_get_string_from_inifile&   s    c         C   s5   |  j  d d d  |  j d d  d k s1 t  d  S(   NR   R   s   print("foo")(   R   R   R   (   R   (    (    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt+   test_userconfig_get_does_not_eval_functions)   s    c         C   ss   |  j  d d d  t |  j     } | j   } Wd  QXd } t rS | d 7} n
 | d 7} | | k so t  d  S(   NR   R   s	   new values   [main]
version = 1.0.0

s    [section]
option = 'new value'

s   [section]
option = new value

(   R   t   opent   filenamet   readR   R   (   R   R   R   t   expected(    (    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt   test_userconfig_set_with_string.   s    
t   __main__(   t   __doc__t   pytestt   spyder.config.userR    t   spyder.py3compatR   t   fixtureR   R   R   R   R    t   __name__t   main(    (    (    s<   lib/python2.7/site-packages/spyder/config/tests/test_user.pyt   <module>	   s   				