Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(13)  |  Call(11)  |  Derive(0)  |  Import(2)

src/o/p/openpack-1.1.2/test/test_basepack.py   openpack(Download)
import py.test
import re
 
from common import SamplePart
from openpack.basepack import *
	def test_reset_part_name_to_invalid_name(self):
		part = SamplePart(None, '/foo')
		for name in self.invalid_names:
			py.test.raises(ValueError, setattr, part, 'name', name)
 
	def test_add_override_false(self):
		self.test_create()
		p = SamplePart(self.pack, '/pmx/samp.vpart')
		self.pack.add(p, override=False)
		ct = self.pack.content_types.find_for('/pmx/samp.vpart')
	def test_add_no_override(self):
		self.test_create()
		p = SamplePart(self.pack, '/pmx/samp.main', content_type='app/pmxmain+xml')
		self.pack.add(p)
		ct = self.pack.content_types.find_for('/pmx/samp.main')
	def test_get_parts_by_content_type(self):
		pack = Package()
		part = SamplePart(pack, '/pmx/samp.main')
		pack.add(part)
		parts = pack.get_parts_by_content_type(part.content_type)

src/o/p/openpack-1.1.2/test/test_zippack.py   openpack(Download)
from openpack.zippack import ZipPackage
 
from common import SamplePart
 
# a few factories for the tests
def test_add_part():
	pack = ZipPackage()
	part = p = SamplePart(pack, '/test/part.xml')
	pack[p.name] = p
	pack.content_types.add_override(p)
	pack.relate(p)
 
def test_write_to_part():
	pack = ZipPackage()
	part = p = SamplePart(pack, '/test/part.xml')
def test_save(writable_filename):
	pack = ZipPackage()
	part = p = SamplePart(pack, '/test/part.xml')
	pack[p.name] = p
	pack.content_types.add_override(p)
def test_save_to_stream():
	pack = ZipPackage()
	part = p = SamplePart(pack, '/test/part.xml')
	pack.add(p)
	part.data = '<test>hi there</test>'