<commit_before>import pytest
import os
os.environ['SENTINEL_ENV'] = 'test'
import sys
sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) )

# NGM/TODO: setup both Proposal and Superblock, and insert related rows,
# including Events

def setup():
    pass
    #this is doog.

def teardown():
    pass
    #you SON OF A BITCH!

# pw_event = PeeWeeEvent.get(
# (PeeWeeEvent.start_time < misc.get_epoch() ) &
# (PeeWeeEvent.error_time == 0) &
# (PeeWeeEvent.prepare_time == 0)
# )
#
# if pw_event:
# govobj = GovernanceObject()
# govobj.load(pw_event.governance_object_id)

# setup/teardown?

# Event model

#govobj.get_prepare_command

# GovernanceObject model
@pytest.fixture
def governance_object():
  from models import PeeWeeGovernanceObject
  from governance import GovernanceObject
  govobj = GovernanceObject()
  #govobj.
  return

def test_prepare_command(governance_object):
  d = governance_object.get_dict()
  assert type(d) == type({})

  fields = [ 'parent_id', 'object_creation_time', 'object_hash',
      'object_parent_hash', 'object_name', 'object_type', 'object_revision',
      'object_data', 'object_fee_tx' ]

  fields.sort()
  sorted_keys = d.keys()
  sorted_keys.sort()
  assert sorted_keys == fields
<commit_msg>flesh out test a wee bit more<commit_after>import pytest
from pprint import pprint
import os
os.environ['SENTINEL_ENV'] = 'test'
import sys
sys.path.append( os.path.join( os.path.dirname(__file__), '..', 'lib' ) )

# NGM/TODO: setup both Proposal and Superblock, and insert related rows,
# including Events

def setup():
    pass
    #this is doog.

def teardown():
    pass
    #you SON OF A BITCH!

# pw_event = PeeWeeEvent.get(
# (PeeWeeEvent.start_time < misc.get_epoch() ) &
# (PeeWeeEvent.error_time == 0) &
# (PeeWeeEvent.prepare_time == 0)
# )
#
# if pw_event:
# govobj = GovernanceObject()
# govobj.load(pw_event.governance_object_id)

# setup/teardown?

# Event model

#govobj.get_prepare_command

# GovernanceObject model
@pytest.fixture
def governance_object():
  from models import PeeWeeGovernanceObject
  from governance import GovernanceObject
  govobj = GovernanceObject()
  govobj.init()

  pprint(vars(govobj.governance_object._meta.database))

  return govobj

def test_prepare_command(governance_object):
  d = governance_object.get_dict()
  assert type(d) == type({})

  fields = [ 'parent_id', 'object_creation_time', 'object_hash',
      'object_parent_hash', 'object_name', 'object_type', 'object_revision',
      'object_data', 'object_fee_tx' ]

  fields.sort()
  sorted_keys = d.keys()
  sorted_keys.sort()
  assert sorted_keys == fields

{'fraction_non_alphanumeric': 0.1251908396946565, 'fraction_numerical': 0.0015267175572519084, 'mean_word_length': 4.697826086956522, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6252057', 'n_tokens_mistral': 966, 'n_tokens_neox': 953, 'n_words': 204}