On Jan 30, 2006, at 5:35 PM, Bruce D'Arcus wrote:

CitationStyle
==========
new (load external CSL file and create object)

OK, here's a start; sorry, just easier for me to think in Ruby. Feel free to jump in and translate to Python if you want. I'm posting this step by step just to make sure I'm on the right track.

#! /usr/bin/env ruby
require 'citeproc'
require 'rubygems'
require_gem 'xml-simple'
require 'test/unit'

class TestCitationStyle < Test::Unit::TestCase

  include CiteProc

  def csl_file
    # for Python, I think elementtree would be appropriate (?)
    XmlSimple.xml_in(File.open("../test/apa-en.csl"))
  end

  def test_load
    assert_not_nil(csl_file)
  end

  def test_build_object
    csl = CitationStyle.new(csl_file)
    # the only reason this one passes is because it's default
    assert(csl.bibliography_sort_algorithm == "author-date")
    # this fails because there is no code yet to construct the object
    # from the XML
    assert(csl.title == "APA")
    # check if bib layout array is correctly built
    assert(csl.bibliography_item_layout["book"][2].key == "title")
  end

end

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to