예제 #1
0
 def test_settings_with_user_none(self):
     user_settings = None
     default_settings = dict(a=False,
                             linewidth=3,
                             marker=dict(markersize=5, color='g'))
     settings = utilities.check_settings(default_settings=default_settings,
                                         user_settings=user_settings)
     self.assertEqual(settings,
                      default_settings,
                      msg=str(
                          'Expect dictionaries to match: {} neq {}'.format(
                              settings, default_settings)))
예제 #2
0
 def test_settings_with_subdict(self):
     user_settings = dict(a=True, fontsize=12)
     default_settings = dict(a=False,
                             linewidth=3,
                             marker=dict(markersize=5, color='g'))
     settings = utilities.check_settings(default_settings=default_settings,
                                         user_settings=user_settings)
     self.assertEqual(settings['a'],
                      user_settings['a'],
                      msg='Expect user setting to overwrite')
     self.assertEqual(settings['marker'],
                      default_settings['marker'],
                      msg='Expect default to persist')
예제 #3
0
 def test_settings_with_subdict_user_has_new_setting(self):
     user_settings = dict(a=True,
                          fontsize=12,
                          marker=dict(color='b'),
                          linestyle='--')
     default_settings = dict(a=False,
                             linewidth=3,
                             marker=dict(markersize=5, color='g'))
     settings = utilities.check_settings(default_settings=default_settings,
                                         user_settings=user_settings)
     self.assertEqual(settings['a'],
                      user_settings['a'],
                      msg='Expect user setting to overwrite')
     self.assertEqual(settings['marker']['color'],
                      user_settings['marker']['color'],
                      msg='Expect user to overwrite')
     self.assertEqual(settings['marker']['markersize'],
                      default_settings['marker']['markersize'],
                      msg='Expect default to persist')
     self.assertEqual(settings['linestyle'],
                      user_settings['linestyle'],
                      msg='Expect user setting to be added')