code: def test_skip_gram_sample_errors():
      """Tests various errors raised by skip_gram_sample()."""
      input_tensor = tf.constant([b"the", b"quick", b"brown"])
  
      invalid_skips = (
          # min_skips and max_skips must be >= 0.
          (-1, 2),
          (1, -2),
          # min_skips must be <= max_skips.
          (2, 1),
      )
      for min_skips, max_skips in invalid_skips:
          with pytest.raises(tf.errors.InvalidArgumentError):
              text.skip_gram_sample(
                  input_tensor, min_skips=min_skips, max_skips=max_skips
              )
  
      # Eager tensor must be rank 1
      with pytest.raises(tf.errors.InvalidArgumentError):
          invalid_tensor = tf.constant(
              [[b"the"], [b"quick"], [b"brown"]]
          )
          text.skip_gram_sample(invalid_tensor)
  
      # vocab_freq_table must be provided if vocab_min_count,
      # vocab_subsampling, or corpus_size is specified.
      dummy_input = tf.constant([""])
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input, vocab_freq_table=None, vocab_min_count=1
          )
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input, vocab_freq_table=None, vocab_subsampling=1e-5
          )
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input, vocab_freq_table=None, corpus_size=100
          )
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input,
              vocab_freq_table=None,
              vocab_subsampling=1e-5,
              corpus_size=100,
          )
  
      # vocab_subsampling and corpus_size must both be present or absent.
      dummy_table = tf.lookup.StaticHashTable(
          tf.lookup.KeyValueTensorInitializer([b"foo"], [10]), -1
      )
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input,
              vocab_freq_table=dummy_table,
              vocab_subsampling=None,
              corpus_size=100,
          )
      with pytest.raises(ValueError):
          text.skip_gram_sample(
              dummy_input,
              vocab_freq_table=dummy_table,
              vocab_subsampling=1e-5,
              corpus_size=None,
          )
  
imports: import csv
  import os
  import tempfile
  import numpy
  import pytest
  import tensorflow
  from tensorflow_addons import text
  from tensorflow_addons.text import skip_gram_ops
label_desc: Use image node_id 12 for calling a global function with example usage: test_skip_gram_sample_errors() without return types