Author: kkaempf Date: Wed Dec 3 18:44:36 2008 New Revision: 11854 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11854&view=rev Log: testcase for Python 'providers' iterator Modified: trunk/sat-solver/bindings/python/tests/providers.py Modified: trunk/sat-solver/bindings/python/tests/providers.py URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/python/tests/providers.py?rev=11854&r1=11853&r2=11854&view=diff ============================================================================== --- trunk/sat-solver/bindings/python/tests/providers.py (original) +++ trunk/sat-solver/bindings/python/tests/providers.py Wed Dec 3 18:44:36 2008 @@ -2,36 +2,36 @@ # Check each_provider callback # -$:.unshift ".." +import unittest -# test EachProvider -require 'test/unit' -require 'satsolver' - -class EachProviderTest < Test::Unit::TestCase - def test_repo_create - pool = Satsolver::Pool.new +import sys +sys.path.insert(0, '../../../build/bindings/python') + +import satsolver + + +class TestSequenceFunctions(unittest.TestCase): + + def test_each_provider(self): + pool = satsolver.Pool() assert pool - pool.arch = "x86_64" - repo = pool.add_solv( "os11-biarch.solv" ) - repo.name = "openSUSE 11.0 Beta3 BiArch" - puts "Repo #{repo.name} loaded with #{repo.size} solvables" + pool.set_arch("x86_64") + repo = pool.add_solv( "../../testdata/os11-biarch.solv" ) + repo.set_name( "openSUSE 11.0 Beta3 BiArch" ) + print "Repo ", repo.name(), " loaded with ", repo.size(), " solvables" system = pool.add_rpmdb( "/" ) - system.name = "@system" - puts "Repo #{system.name} loaded with #{system.size} solvables" - - pool.prepare + system.set_name("@system") + print "Repo ", system.name(), " loaded with ", system.size(), " solvables" - puts "Providers of 'ispell_dictionary':" - pool.each_provider( "ispell_dictionary" ) { |s| - puts " #{s} [#{s.repo.name}]" - } - - rel = pool.create_relation( "ispell_english_dictionary", Satsolver::REL_GT, "3.3.02-23" ) + pool.prepare() + + i = 0 + for solv in pool.providers("ispell_dictionary"): + print solv, " provides ispell_dictionary" - puts "Providers of #{rel}:" - pool.each_provider(rel) { |s| - puts " #{s} [#{s.repo.name}]" - } - end -end + rel = pool.create_relation( "ispell_english_dictionary", satsolver.REL_GT, "3.3.02-23" ) + for solv in pool.providers(rel): + print solv, solv.repo().name() + +if __name__ == '__main__': + unittest.main() -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org