def test_new_cache(self): """Verify new items are cached.""" mock_tree = Mock() mock_tree._item_cache = {} item = MockItem.new(mock_tree, None, EMPTY, FILES, 'TEST00042', level=(1, 2, 3)) self.assertEqual(item, mock_tree._item_cache[item.uid])
def test_new_special(self): """Verify items can be created with a specially named prefix.""" MockItem._create.reset_mock() item = MockItem.new(None, None, EMPTY, FILES, 'VSM.HLR_01-002-042', level=(1, 0)) path = os.path.join(EMPTY, 'VSM.HLR_01-002-042.yml') self.assertEqual(path, item.path) self.assertEqual((1,), item.level) MockItem._create.assert_called_once_with(path, name='item')
def test_new(self): """Verify items can be created.""" MockItem._create.reset_mock() item = MockItem.new(None, None, EMPTY, FILES, 'TEST00042', level=(1, 2, 3)) path = os.path.join(EMPTY, 'TEST00042.yml') self.assertEqual(path, item.path) self.assertEqual((1, 2, 3), item.level) MockItem._create.assert_called_once_with(path, name='item')
def test_new_special(self): """Verify items can be created with a specially named prefix.""" MockItem._create.reset_mock() item = MockItem.new(None, None, EMPTY, FILES, 'VSM.HLR_01-002-042', level=(1, 0)) path = os.path.join(EMPTY, 'VSM.HLR_01-002-042.yml') self.assertEqual(path, item.path) self.assertEqual((1, ), item.level) MockItem._create.assert_called_once_with(path, name='item')