コード例 #1
0
ファイル: template.py プロジェクト: jkloo/memegen
 def _load(self):
     self._items = {}
     for key in os.listdir(self.root):
         if key[0] not in ('.', '_'):
             model = TemplateModel(key, self.root)
             yorm.update_object(model)
             model.key = key  # TODO: this line shouldn't be required
             self._items[key] = model
     print(self._items.values())
コード例 #2
0
    def test_alias_list(self):
        yorm.update_object(self.sample)
        var4_ref = self.sample.var4
        self._log_ref('var4', self.sample.var4, var4_ref)
        assert [] == self.sample.var4

        logging.info("appending 42 to var4_ref...")
        var4_ref.append(42)
        self._log_ref('var4', self.sample.var4, var4_ref)
        assert [42] == self.sample.var4

        logging.info("appending 2015 to var4_ref...")
        var4_ref.append(2015)
        assert [42, 2015] == self.sample.var4
コード例 #3
0
    def test_alias_list(self):
        yorm.update_object(self.sample)
        var4_ref = self.sample.var4
        self._log_ref('var4', self.sample.var4, var4_ref)
        assert [] == self.sample.var4

        logging.info("appending 42 to var4_ref...")
        var4_ref.append(42)
        self._log_ref('var4', self.sample.var4, var4_ref)
        assert [42] == self.sample.var4

        logging.info("appending 2015 to var4_ref...")
        var4_ref.append(2015)
        assert [42, 2015] == self.sample.var4
コード例 #4
0
    def test_alias_dict(self):
        yorm.update_object(self.sample)
        var5_ref = self.sample.var5
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': False} == self.sample.var5

        logging.info("setting status=True in var5_ref...")
        var5_ref['status'] = True
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': True} == self.sample.var5

        logging.info("setting status=False in var5_ref...")
        var5_ref['status'] = False
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': False} == self.sample.var5
コード例 #5
0
    def test_alias_dict(self):
        yorm.update_object(self.sample)
        var5_ref = self.sample.var5
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': False} == self.sample.var5

        logging.info("setting status=True in var5_ref...")
        var5_ref['status'] = True
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': True} == self.sample.var5

        logging.info("setting status=False in var5_ref...")
        var5_ref['status'] = False
        self._log_ref('var5', self.sample.var5, var5_ref)
        assert {'status': False} == self.sample.var5