<commit_before>import unittest
from spitfire.runtime import _udn
from spitfire.runtime import udn


class Foo(object):
  bar = 'win'


class TestCUdn(unittest.TestCase):
  def testResolveHitWithoutException(self):
    self.assertEqual(_udn._resolve_udn(Foo(), 'bar'), 'win')

  def testResolveHitWithException(self):
    self.assertEqual(_udn._resolve_udn(Foo(), 'bar', raise_exception=True),
                     'win')

  def testResolveMissWithoutException(self):
    self.assertIsInstance(_udn._resolve_udn(Foo(), 'missing'),
                          udn.UndefinedAttribute)

  def testResolveMissWithException(self):
    self.assertRaises(udn.UDNResolveError, _udn._resolve_udn, Foo(), 'misssing',
                      raise_exception=True)
<commit_msg>I was wondering if it's UndefinedPlaceholders all the way down so I wrote a test. (It is)<commit_after>import unittest
from spitfire.runtime import _udn
from spitfire.runtime import udn


class Foo(object):
  bar = 'win'


class TestCUdn(unittest.TestCase):
  def testResolveHitWithoutException(self):
    self.assertEqual(_udn._resolve_udn(Foo(), 'bar'), 'win')

  def testResolveHitWithException(self):
    self.assertEqual(_udn._resolve_udn(Foo(), 'bar', raise_exception=True),
                     'win')

  def testResolveMissWithoutException(self):
    self.assertIsInstance(_udn._resolve_udn(Foo(), 'missing'),
                          udn.UndefinedAttribute)

  def testResolveDoubleMissWithoutException(self):
    """Shows that it's UndefinedAttribute's all the way down."""
    undefined_attr = _udn._resolve_udn(Foo(), 'missing')
    self.assertIsInstance(undefined_attr, udn.UndefinedAttribute)
    undefined_attr2 = _udn._resolve_udn(undefined_attr, 'missing')
    self.assertIsInstance(undefined_attr2, udn.UndefinedAttribute)

  def testResolveMissWithException(self):
    self.assertRaises(udn.UDNResolveError, _udn._resolve_udn, Foo(), 'misssing',
                      raise_exception=True)

{'fraction_non_alphanumeric': 0.1065989847715736, 'fraction_numerical': 0.0010152284263959391, 'mean_word_length': 4.186842105263158, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2215929', 'n_tokens_mistral': 614, 'n_tokens_neox': 590, 'n_words': 114}