Exemple #1
0
 def test_add_new_claim_embedded_ref_used(self):
     statement = Statement(self.value)
     statement.add_reference(self.mock_ref_2)
     self.wd_stuff.add_new_claim(self.prop, statement, self.wd_page, None)
     self.mock_add_reference.assert_called_once()
     self.assertEqual(self.mock_add_reference.call_args[0][2],
                      self.mock_ref_2)
 def test_statement_add_bad_reference_error(self):
     s = Statement('foo')
     with self.assertRaises(pwbError) as cm:
         s.add_reference('foo')
     self.assertEqual(
         str(cm.exception), 'add_reference was called with something other '
         'than a Reference object: foo')
 def test_statement_add_second_reference_error(self):
     s = Statement('foo').add_reference(self.ref)
     with self.assertRaises(pwbError) as cm:
         s.add_reference(self.ref)
     self.assertEqual(
         str(cm.exception),
         'add_reference was called when the statement already had '
         'a reference assigned to it.')
 def test_statement_add_bad_reference_error(self):
     s = Statement('foo')
     with self.assertRaises(pwbError) as cm:
         s.add_reference('foo')
     self.assertEqual(
         str(cm.exception),
         'add_reference was called with something other '
         'than a Reference object: foo')
 def test_statement_add_second_reference_error(self):
     s = Statement('foo').add_reference(self.ref)
     with self.assertRaises(pwbError) as cm:
         s.add_reference(self.ref)
     self.assertEqual(
         str(cm.exception),
         'add_reference was called when the statement already had '
         'a reference assigned to it.')
 def test_add_new_claim_provided_ref_overrides_embedded_ref(self):
     statement = Statement(self.value)
     statement.add_reference(self.mock_ref_2)
     self.wd_stuff.add_new_claim(
         self.prop, statement, self.wd_page, self.mock_ref_1)
     self.mock_add_reference.assert_called_once()
     self.assertEqual(
         self.mock_add_reference.call_args[0][2],
         self.mock_ref_1)
 def test_statement_repr(self):
     s = Statement('foo')
     self.assertEqual(
         repr(s), 'WD.Statement('
         'itis:foo, quals:[], ref:None, special:False, force:False)')
     s.add_qualifier(self.q_1)
     self.assertEqual(
         repr(s), 'WD.Statement('
         'itis:foo, quals:[WD.Qualifier(P123, foo)], ref:None, '
         'special:False, force:False)')
     s.add_reference(self.ref)
     self.assertEqual(
         repr(s), 'WD.Statement('
         'itis:foo, quals:[WD.Qualifier(P123, foo)], '
         'ref:WD.Reference(test: [WD.Claim(P55: foo)], no_test: []), '
         'special:False, force:False)')
 def test_statement_repr(self):
     s = Statement('foo')
     self.assertEqual(
         repr(s),
         'WD.Statement('
         'itis:foo, quals:[], ref:None, special:False, force:False)')
     s.add_qualifier(self.q_1)
     self.assertEqual(
         repr(s),
         'WD.Statement('
         'itis:foo, quals:[WD.Qualifier(P123, foo)], ref:None, '
         'special:False, force:False)')
     s.add_reference(self.ref)
     self.assertEqual(
         repr(s),
         'WD.Statement('
         'itis:foo, quals:[WD.Qualifier(P123, foo)], '
         'ref:WD.Reference(test: [WD.Claim(P55: foo)], no_test: []), '
         'special:False, force:False)')
 def test_statement_add_reference(self):
     s = Statement('foo')
     s.add_reference(self.ref)
     self.assertEquals(s.ref, self.ref)
 def test_statement_add_reference(self):
     s = Statement('foo')
     s.add_reference(self.ref)
     self.assertEqual(s.ref, self.ref)