def testget_all_values(self): c1 = Command('tag', 'adder', 1, 2, a=3, b=4) c1.add_other_dep(5) all_vals = c1.all_values set_all = set(all_vals) self.failUnlessEqual(set_all, set(range(1, 6)))
def testhas_unusedsource(self): cmd = Command('foo', None, Source) self.failUnless(cmd.has_unusedsource()) cmd = Command('foo', None, t=Source) self.failUnless(cmd.has_unusedsource()) cmd = Command('foo', None) cmd.add_other_dep(Source) self.failUnless(cmd.has_unusedsource()) self.failIf(self.c1.has_unusedsource())
def testhas_unusedtarget(self): cmd = Command('foo', None, Target) self.failUnless(cmd.has_unusedtarget()) cmd = Command('foo', None, t=Target) self.failUnless(cmd.has_unusedtarget()) cmd = Command('foo', None) cmd.add_other_dep(Target) self.failUnless(cmd.has_unusedtarget()) self.failIf(self.c1.has_unusedtarget())
def testsetunusedsource(self): foo_src = Source('foo') cmd = Command('foo', None, Source) cmd.setunusedsource(foo_src) sources = cmd.getSources() self.failUnlessEqual(sources, [foo_src]) self.failUnlessRaises(Exception, cmd.setunusedsource, foo_src) cmd = Command('foo', None, Target) self.failUnlessRaises(Exception, cmd.setunusedsource, foo_src) cmd.add_other_dep(foo_src) self.failUnlessEqual(sources, [foo_src])
def testsetunusedtarget(self): foo_tgt = Target('foo') cmd = Command('foo', None, Target) cmd.setunusedtarget(foo_tgt) targets = cmd.getTargets() self.failUnlessEqual(targets, [foo_tgt]) self.failUnlessRaises(Exception, cmd.setunusedtarget, foo_tgt) cmd = Command('foo', None, Source) self.failUnlessRaises(Exception, cmd.setunusedtarget, foo_tgt) cmd.add_other_dep(foo_tgt) self.failUnlessEqual(targets, [foo_tgt])
def testgetSources(self): foo_src = Source('foo') bar_src = Source('bar') spam_src = Source('spam') spam_tgt = Target('eggs') c1 = Command('foo', None, foo_src, x=bar_src, ssc=spam_tgt) c1.add_other_dep(spam_src) sources = c1.getSources() self.failUnless(foo_src in sources) self.failUnless(bar_src in sources) self.failUnless(spam_src in sources) # print sources self.failIf(spam_tgt in sources) c1 = Command('foo', None) targets = c1.getSources() self.failUnlessEqual(targets, [])